﻿---
name: bank131-payments-via-sberpay
description: Use when the user asks about accepting payments via SberPay: `payment_details` with `type: internet_banking` and `internet_banking.type: sber_pay`, the `sber_pay` object with the `channel` parameter (`app`, `mobile_web`, `web`), `payment_options.return_url`, sending PUSH and SMS notifications with `sberpay/push`, and the 20-minute payment confirmation period.
---

### How it works

This scenario describes accepting a payment via SberPay. No card details are required from the customer.

The payment scenario depends on the customer's payment channel: mobile application (`app`), mobile browser (`mobile_web`), or desktop browser (`web`).

Request structure (`payment_details`):

- `type` — `internet_banking`;
- `internet_banking.type` — `sber_pay`;
- `internet_banking.sber_pay` — the object with the payment parameters:
  - `channel` — required. Possible values: `app`, `mobile_web`, `web`;
  - `phone` — optional, the phone number for sending PUSH or SMS. Format: `7**********`.

`payment_options.return_url` is the URL for redirecting the customer back after payment.

### Payment flow

1. Create a payment session separately with `session/create` or together with the payment with `session/init/payment`, passing the required parameters. If you created a separate session, send `session/start/payment`.
2. Wait for the `ready_to_confirm` webhook — the Bank is ready to process the payment and is waiting for your confirmation.
3. Confirm the payment with `session/confirm` or cancel it with `session/cancel`. You have **20 minutes** to confirm — if you do not send confirmation within 20 minutes, the payment will not be made and the session will finish with the `canceled` status.
4. Wait for the `action_required` webhook with the URL in `redirect.url` to forward the customer to a Sber mobile application.
5. For iOS devices, forward the customer by the deeplink from `redirect.url` to one of the Sber applications, using the app selection algorithm with the deeplinks `onlineios-app://sbolpay/...`, `startonline://sbolpay/...` and others.
6. Wait until the customer approves or cancels the payment. Sber sends the customer back by the deeplink or URL passed in `return_url`.
7. Wait for the `payment_finished` webhook with the payment result, or poll the transaction status (no more often than once every 5 seconds).
8. Report the payment status to the customer.

If the customer refuses the payment, this becomes known only after 20 minutes — when the SberPay order's lifetime expires.

### Channel

The channel is set in `internet_banking.sber_pay.channel`:

- `app` — mobile application;
- `mobile_web` — mobile browser;
- `web` — desktop browser. For this channel, additionally pass the customer's phone number in `sber_pay.phone`.

### PUSH and SMS notifications

You can additionally send PUSH or SMS notifications using the `sberpay/push` method. Request parameters:

- `session_id` — the session id;
- `phone` — the phone number for sending the notification.

The choice between PUSH and SMS is made by the provider (Sber). It is not recommended to use `sberpay/push` together with `channel = app` — a successful payment is not guaranteed in this case.

### Recurring payments

CIT recurring payments via SberPay are not supported.

For MIT recurring payments via SberPay:

1. Get a recurring token by passing `recurrent = true` in `payment_options`. If the payment succeeds, the token comes in `payment_finished` in the `recurrent.token` parameter.
2. For subsequent payments, pass the recurring token — with `type: recurrent` and the token in `recurrent.token`.