SberPay
Specifics
- Payment method type in the API:
sberbank
- Confirmation scenario: Redirect, External, Mobile application, and QR code
- Payment term: 1 hour
- Holding: 5 days, full and partial payment capture is available
- Code in reports: SB
- Refund: yes, full and partial
- Refund processing time: instantly
- Recurring payments: available
- Limits: the minimum payment amount is 1 ruble, and the maximum amount is 700,000 rubles (you can raise the limit by contacting the manager), there are additional restrictions
Integration scenarios
Ready-made solutions:
- Smart payment
- YooMoney Checkout Widget
- Mobile SDKs for iOS and Android
Manual integration:
- Payment via SberPay on YooMoney’s ready-made page
- Payment with confirmation via push notification or text messages
- Payment with redirection to the bank app (for mobile devices)
- Payment with redirection to the bank app (for desktops)
Payment via SberPay on YooMoney’s ready-made page
In this scenario, you redirect the user to the YooMoney page after the payment is created. On this page, the user scans the QR code to open bank's mobile app and enters the phone number linked to SberBank Online to receive a push notification or text message.
Step 1. Create a payment , send the
sberbank
type in the payment_method_data
object, and in the confirmation
object send the redirect
type and the URL of the page on your side where users will be redirected after the payment (in the return_url
parameter).Example of request
cURL
PHP
Python
curl https://api.yookassa.ru/v3/payments \ -X POST \ -u <Shop ID>:<Secret Key> \ -H 'Idempotence-Key: <Idempotence Key>' \ -H 'Content-Type: application/json' \ -d '{ "amount": { "value": "2.00", "currency": "RUB" }, "payment_method_data": { "type": "sberbank" }, "confirmation": { "type": "redirect", "return_url": "https://www.example.com/return_url" }, "description": "Order No. 72" }'
Step 2. Redirect the user to the YooMoney’s page (you will receive the URL in the
confirmation_url
parameter). On this page, the user will enter the bank card details and confirm the payment.Example of a created payment object
JSON
{ "id":"22e12f66-000f-5000-8000-18db351245c7", "status":"pending", "paid":false, "amount":{ "value":"2.00", "currency":"RUB" }, "confirmation":{ "type":"redirect", "confirmation_url":"https://yoomoney.ru/api-pages/v2/payment-confirm/epl?orderId=23d93cac-000f-5000-8000-126628f15141" }, "created_at":"2018-07-18T10:51:18.139Z", "description":"Order No. 72", "metadata":{ "order_id":"72" }, "recipient":{ "account_id":"100500", "gateway_id":"100700" }, "refundable":false, "test":false }
If a payment via SberPay doesn't go through (for example, if there wasn't enough money), YooMoney will display an error message to the user and prompt them to try again.
Step 3. Wait for the payment to be successfully completed: you will receive a notification from YooMoney, or you can send periodic requests for payment information .
Example of a successful payment
JSON
{ "id":"22e12f66-000f-5000-8000-18db351245c7", "status":"succeeded", "paid":true, "amount":{ "value":"2.00", "currency":"RUB" }, "captured_at":"2021-04-13T09:27:09.960Z", "created_at":"2021-04-13T09:25:13.087Z", "description":"Order No. 72", "income_amount":{ "value":"2.00", "currency":"RUB" }, "payment_method":{ "type":"sberbank", "id":"22e12f66-000f-5000-8000-18db351245c7", "saved":false, "card":{ "first6":"555555", "last4":"4444", "expiry_year":"2022", "expiry_month":"07", "card_type":"MasterCard" } }, "recipient":{ "account_id":"100500", "gateway_id":"100700" }, "refundable":true, "refunded_amount":{ "value":"0.00", "currency":"RUB" }, "test":false, "authorization_details":{ "rrn":"10000000000", "auth_code":"000000", "three_d_secure":{ "applied":false } } }
Step 4. After the user returns to
return_url
, display the results of payment processing (success or failure) depending on the payment status.Payments with confirmation via push notifications or text messages
In this scenario, you request user's phone number linked to SberBank Online and inform the user that they're going to receive a push notification or text message to this number. To confirm the payment, the user needs to tap on the push notification or respond to the text message.
Step 1. Create a payment with the
sberbank
type as well as the user’s phone number, linked to the SberBank Online account, in the payment_method_data
object, and the external
type in the confirmation
object.Example of request
cURL
PHP
Python
curl https://api.yookassa.ru/v3/payments \ -X POST \ -u <Shop ID>:<Secret Key> \ -H 'Idempotence-Key: <Idempotence Key>' \ -H 'Content-Type: application/json' \ -d '{ "amount": { "value": "2.00", "currency": "RUB" }, "payment_method_data": { "type": "sberbank", "phone": "79000000000" }, "confirmation": { "type": "external", }, "description": "Order No. 72" }'
Example of a created payment object
JSON
{ "id":"22e12f66-000f-5000-8000-18db351245c7", "status":"pending", "paid":false, "amount":{ "value":"2.00", "currency":"RUB" }, "confirmation":{ "type":"external" }, "created_at":"2018-07-18T10:51:18.139Z", "description":"Order No. 72", "metadata":{ "order_id":"72" }, "payment_method":{ "type":"sberbank", "phone":"79000000000" }, "recipient":{ "account_id":"100500", "gateway_id":"100700" }, "refundable":false, "test":false }
Step 2. Inform the user that they need to confirm the payment.
Step 3. Wait for the payment to be successfully completed: you will receive a notification from YooMoney, or you can send periodic requests for payment information .
Example of a successful payment
JSON
{ "id":"22e12f66-000f-5000-8000-18db351245c7", "status":"succeeded", "paid":true, "amount":{ "value":"2.00", "currency":"RUB" }, "captured_at":"2021-04-13T09:27:09.960Z", "created_at":"2021-04-13T09:25:13.087Z", "description":"Order No. 72", "income_amount":{ "value":"2.00", "currency":"RUB" }, "payment_method":{ "type":"sberbank", "id":"22e12f66-000f-5000-8000-18db351245c7", "saved":false, "card":{ "first6":"555555", "last4":"4444", "expiry_year":"2022", "expiry_month":"07", "card_type":"MasterCard" } }, "recipient":{ "account_id":"100500", "gateway_id":"100700" }, "refundable":true, "refunded_amount":{ "value":"0.00", "currency":"RUB" }, "test":false, "authorization_details":{ "rrn":"10000000000", "auth_code":"000000", "three_d_secure":{ "applied":false } } }
Step 4. Display the results of payment processing (success or failure) depending on the payment status.
Payment with redirection to the bank app (for mobile devices)
We recommend using it only for accepting payments via mobile devices (via the mobile app or mobile web version).
In this scenario, you redirect the user to the SberBank mobile app via a deeplink after the payment. They confirm the payment in this app.
Step 1. Create a payment , send the
sberbank
type in the payment_method_data
object, the mobile_application
type in the confirmation
object, and the deep link to your app or the link to your store’s page (for payments via mobile web) in the return_url
parameter.Example of request
cURL
PHP
Python
curl https://api.yookassa.ru/v3/payments \ -X POST \ -u <Shop ID>:<Secret Key> \ -H 'Idempotence-Key: <Idempotence Key>' \ -H 'Content-Type: application/json' \ -d '{ "amount": { "value": "2.00", "currency": "RUB" }, "payment_method_data": { "type": "sberbank" }, "confirmation": { "type": "mobile_application", "return_url": "https://www.example.com/return_url" }, "description": "Order No. 72" }'
Example of a created payment object
JSON
{ "id":"22e12f66-000f-5000-8000-18db351245c7", "status":"pending", "paid":false, "amount":{ "value":"2.00", "currency":"RUB" }, "payment_method":{ "type":"sberbank" }, "confirmation":{ "type":"mobile_application", "confirmation_url":"sberpay://invoicing/v2?bankInvoiceId=5eae1999faf15d5e49ee5bd7333ac5a5&operationType=App2App&payment_id=22e12f66-000f-5000-8000-18db351245c7" }, "created_at":"2018-07-18T10:51:18.139Z", "description":"Order No. 72", "metadata":{ "order_id":"72" }, "recipient":{ "account_id":"100500", "gateway_id":"100700" }, "refundable":false, "test":false }
Step 2. Redirect the user to the SberBank Online app via the deeplink returned in the
confirmation_url
parameter. The user will sign in to the app and go to the payment process.Step 3. Wait for the payment to be successfully completed: you will receive a notification from YooMoney, or you can send periodic requests for payment information .
Example of a successful payment
JSON
{ "id":"22e12f66-000f-5000-8000-18db351245c7", "status":"succeeded", "paid":true, "amount":{ "value":"2.00", "currency":"RUB" }, "captured_at":"2021-04-13T09:27:09.960Z", "created_at":"2021-04-13T09:25:13.087Z", "description":"Order No. 72", "income_amount":{ "value":"2.00", "currency":"RUB" }, "payment_method":{ "type":"sberbank", "id":"22e12f66-000f-5000-8000-18db351245c7", "saved":false, "card":{ "first6":"555555", "last4":"4444", "expiry_year":"2022", "expiry_month":"07", "card_type":"MasterCard" } }, "recipient":{ "account_id":"100500", "gateway_id":"100700" }, "refundable":true, "refunded_amount":{ "value":"0.00", "currency":"RUB" }, "test":false, "authorization_details":{ "rrn":"10000000000", "auth_code":"000000", "three_d_secure":{ "applied":false } } }
Step 4. After the user returns to
return_url
, display the results of payment processing (success or failure) depending on the payment status.Payment with redirection to the bank app (for desktops)
We recommend using it only for the desktop version of the website. Use the Mobile application scenario for the mobile version.
In this scenario, your actions depend on which version of your website is used for the payment:
- If the payment is made via the desktop version of the website, you generate a QR code, which the user scans in the SberBank app.
- If the payment is made via the mobile version, you redirect the user to the SberBank mobile app via a deeplink.
In the SberBank app, the user confirms the payment and sees if it's successful or not.
Step 1. Create a payment , send the
sberbank
type in the payment_method_data
object, the qr
type in the confirmation
object.Example of request
cURL
PHP
Python
curl https://api.yookassa.ru/v3/payments \ -X POST \ -u <Shop ID>:<Secret Key> \ -H 'Idempotence-Key: <Idempotence Key>' \ -H 'Content-Type: application/json' \ -d '{ "amount": { "value": "2.00", "currency": "RUB" }, "payment_method_data": { "type": "sberbank" }, "confirmation": { "type": "qr" }, "description": "Order No. 72" }'
Step 2. YooMoney will send you a URL in
confirmation_data
. Generate a QR code using any available tool and display it to the user. For the mobile version or the app, redirect the user to this URL (for example, when they tap the Pay button) and inform the user that they need to return to your store’s page after paying.Example of a created payment object
JSON
{ "id":"22e12f66-000f-5000-8000-18db351245c7", "status":"pending", "paid":false, "amount":{ "value":"2.00", "currency":"RUB" }, "confirmation":{ "type":"qr", "confirmation_data": "sberpay://invoicing/v2?bankInvoiceId=successPaymentInApp2433394341762973&operationType=Web2App" }, "created_at":"2021-04-12T13:03:20.155Z", "description":"Order No. 72", "metadata":{ "order_id":"72" }, "payment_method":{ "type":"sberbank", "id": "22e12f66-000f-5000-8000-18db351245c7", "saved": false }, "recipient":{ "account_id":"100500", "gateway_id":"100700" }, "refundable":false, "test":false }
Step 3. Wait for the payment to be successfully completed: you will receive a notification from YooMoney, or you can send periodic requests for payment information .
Example of a successful payment
JSON
{ "id":"22e12f66-000f-5000-8000-18db351245c7", "status":"succeeded", "paid":true, "amount":{ "value":"2.00", "currency":"RUB" }, "captured_at":"2021-04-13T09:27:09.960Z", "created_at":"2021-04-13T09:25:13.087Z", "description":"Order No. 72", "income_amount":{ "value":"2.00", "currency":"RUB" }, "payment_method":{ "type":"sberbank", "id":"22e12f66-000f-5000-8000-18db351245c7", "saved":false, "card":{ "first6":"555555", "last4":"4444", "expiry_year":"2022", "expiry_month":"07", "card_type":"MasterCard" } }, "recipient":{ "account_id":"100500", "gateway_id":"100700" }, "refundable":true, "refunded_amount":{ "value":"0.00", "currency":"RUB" }, "test":false, "authorization_details":{ "rrn":"10000000000", "auth_code":"000000", "three_d_secure":{ "applied":false } } }
Step 4. Display the results of payment processing (success or failure) depending on the payment status.
Specifics of redirecting the user to the bank app
For those who accept payments in the iOS or Android mobile app and use scenarios with redirection to the bank app.
In scenarios with redirection to the bank app, YooMoney returns a deeplink in the payment object. Using this deeplink, you need to redirect the user to the bank app to confirm the payment.
SberBank has several apps:
App | Scheme | Operating system |
---|---|---|
Budget Online (Бюджет Онлайн) | budgetonline-ios://sbolpay | iOS |
SberBank Online (СберБанк Онлайн) | sberpay | Android, iOS |
SBOL (СБОЛ) | sbolpay | Android, iOS |
Smart Online (Умный Онлайн) | ios-app-smartonline://sbolpay | iOS |
Accounting Online (Учет Онлайн) | btripsexpenses://sbolpay | iOS |
Any of them may be used to confirm the payment, but you won't know in advance which one to redirect the user to. In order to be sure that the user will be redirected to the necessary bank app and confirm the payment successfully, you need to develop your app. To do this, follow these instructions:
Developing the iOS app
You need to enable the option for launching bank apps from your app, and set up redirection of users to multiple bank apps at once to confirm payments.
Setting up the launch of bank apps
Step 1. Configure processing of all redirects in SberBank apps:
App | Scheme |
---|---|
Budget Online | budgetonline-ios://sbolpay |
SberBank Online | sberpay |
SBOL | sbolpay |
Smart Online | ios-app-smartonline://sbolpay |
Accounting Online | btripsexpenses://sbolpay |
Redirects by these schemes need to be proceed via the system API.
Example of redirect processing
Swift
func webView( _ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, preferences: WKWebpagePreferences, decisionHandler: @escaping (WKNavigationActionPolicy, WKWebpagePreferences) -> Void ) { if let url = navigationAction.request.url, let host = url.scheme, host.hasPrefix("btripsexpenses://sbolpay") || host.hasPrefix("budgetonline-ios://sbolpay") || host.hasPrefix("ios-app-smartonline://sbolpay") || host.hasPrefix("sbolpay") || host.hasPrefix("sberpay") { if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url) } decisionHandler(.cancel, preferences) } else { decisionHandler(.allow, preferences) } }
Step 2. Add the schemes from the table to the
Info.plist
configuration file so that your app could launch SberBank apps:Example of the Info.plist file
XML
<key>LSApplicationQueriesSchemes</key> <array> <string>btripsexpenses://sbolpay</string> <string>budgetonline-ios://sbolpay</string> <string>ios-app-smartonline://sbolpay</string> <string>sbolpay</string> <string>sberpay</string> </array>
Redirecting a user to multiple bank apps
Use the iOS app to redirect a user to all apps one by one. This can be done as follows:
Step 1. Obtain a deeplink leading to the SberBank Online app from the payment object returned by YooMoney. The scheme for this deeplink:
sberpay
.Example of the deeplink for SberBank Online app
sberpay://invoicing/v2?bankInvoiceId=5eae1999faf15d5e49ee5bd7333ac5a5&operationType=App2App&payment_id=22e12f66-000f-5000-8000-18db351245c7
Step 2. Create a new deeplink leading to the Accounting Online app. To do this, change the scheme to
btripsexpenses://sbolpay
.Example of the deeplink for Accounting Online app
btripsexpenses://sbolpay://invoicing/v2?bankInvoiceId=5eae1999faf15d5e49ee5bd7333ac5a5&operationType=App2App&payment_id=22e12f66-000f-5000-8000-18db351245c7
Step 3. Create a new deeplink in the Budget Online app: change the scheme to
budgetonline-ios://sbolpay
.Example of the deeplink for Budget Online app
budgetonline-ios://sbolpay/invoicing/v2?bankInvoiceId=5eae1999faf15d5e49ee5bd7333ac5a5&operationType=App2App&payment_id=22e12f66-000f-5000-8000-18db351245c7
Step 4. Create a new deeplink leading to the Smart Online app: change the scheme to
ios-app-smartonline://sbolpay
.Example of the deeplink for Smart Online app
ios-app-smartonline://sbolpay/invoicing/v2?bankInvoiceId=5eae1999faf15d5e49ee5bd7333ac5a5&operationType=App2App&payment_id=22e12f66-000f-5000-8000-18db351245c7
Step 5. Create a new deeplink leading to the SBOL app: change the scheme to
sbolpay
.Example of the deeplink for SBOL app
sbolpay://invoicing/v2?bankInvoiceId=5eae1999faf15d5e49ee5bd7333ac5a5&operationType=App2App&payment_id=22e12f66-000f-5000-8000-18db351245c7
Step 6. Redirect the user by generated deeplinks step by step. The sequence is as follows:
- Accounting Online (scheme
btripsexpenses://sbolpay
) - Budget Online (scheme
budgetonline-ios://sbolpay
) - Smart Online (scheme
ios-app-smartonline://sbolpay
) - SBOL (scheme
sbolpay
) - SberBank Online (scheme
sberpay
)
If there're several apps installed on the user's device to access the mobile bank, one of them will open.
Developing the Android app
You need to configure redirect processing in order to activate payment confirmation in SberBank Online and SBOL apps. To do this, override the
shouldOverrideUrlLoading
method as follows:- When you process a payment, check
url
for redirect schemes leading to SberBank Online and SBOL (schemessberpay
andsbolpay
respectively). - If
url
contains the scheme you need, make sure that such a deeplink could be launched on the device. - If it's possible, call the
startActivity
method to launch the SberBank app.
Example of overriding the shouldOverrideUrlLoading method
Java
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean { if (url.contains("sberpay") || url.contains("sbolpay")) { val intent = Intent(Intent.ACTION_VIEW).setData(Uri.parse(url)) if (intent.resolveActivity(requireActivity().packageManager) != null) { startActivity(intent) } else { view.loadUrl(url) } } else { view.loadUrl(url) } return true }
See also