SBP
Introduction
You can accept payments via SBP (the Fast Payment System) of the National Payment Card System (NSPK). In this case, the client scans a dynamic of static QR code in a browser or clicks the button in a mobile application to make a payment instead of entering card data.
To enable the ability to accept payments via SBP, contact technical support.
Payment via dynamic QR code
Payment on payment page
- The Customer places an order and proceeds to payment.
- The Merchant sends an order registration request to the Payment Gateway – register.do.
- In response to a registration request, the Payment Gateway returns a unique order identifier in the payment system (in the
orderIdparameter) and a URL to which the Customer must be redirected to receive the payment form (in theformUrlparameter). - The Merchant's system sends to the Customer's browser a redirect to the URL (see Step 3).
- Customer's browser requests the payment form at received URL.
- The browser displays the payment page, where the Customer chooses to pay via SBP.
- The payment page requests a QR code from the Payment Gateway.
- The Payment Gateway sends a QR code request to NSPK.
- NSPK returns a response to the QR code request.
- A QR code is displayed to the Customer in a browser. In case of a mobile app, the button for payment is displayed.
- The Customer scans the QR code using specialized software or (in case of a mobile app) clicks the button and makes a payment.
- The Payment Gateway receives a response with the payment result.
-
If the payment is unsuccessful, then the number of payment attempts is reduced and the Payment Gateway sends a callback about the unsuccessful payment to the Merchant’s system.
If the payment is successful, Steps 13–14 are skipped and the scenario goes to Step 15.
If the Merchant is configured to send notifications (callbacks, email), then a notification is sent to the Customer about unsuccessful payment for the order. The process stops.
The Payment Gateway sends a request to NSPK about the final status of the payment.
NSPK returns a callback with the payment status.
The Payment Gateway moves the order to the "Deposited" status.
The Payment Gateway sends a callback about successful payment to the Merchant's system.
If the Merchant is configured to send notifications (callbacks, email), then a notification is sent to the Customer about successful payment for the order.
Payment in a payment form on Merchant side
- The Customer places an order and initiates payment. See customer identification.
- The Merchant sends an order registration request to the Payment Gateway – register.do.
- In response to a registration request, the Payment Gateway returns a unique order identifier in the payment system (in the
orderIdparameter). - The Merchant redirects the Customer to the Merchant's payment form.
- The Customer chooses to pay via SBP.
- The Merchant sends a request to receive a QR code to the Payment Gateway – sbp/c2b/qr/dynamic/get.do.
- The Payment Gateway sends a QR code request to NSPK.
- NSPK returns a response to the QR code request.
- The Payment Gateway returns a response to the QR code request to the Merchant's system.
-
Depending on where the payment is made, the action at this step may be one of the following:
- On the Merchant's payment form in a web browser: the Merchant displays the QR code from the
renderedQrparameter to the Client. - In WebView with Merchant payment form opened from mobile app: The Merchant opens a link from the
payloadparameter in WebView. Whenpayloadis opened via WebView, the JS SBP widget is launched, which, when a bank is selected, forms a direct Deep Link. After that, the Deep Link shall be followed. -
In the mobile app itself (the payment button on step 5 is located in the Merchant application, not on the payment form in WebView) there are several options:
- The Merchant uses the SDK of the SBP widget so that the Client can select a bank. As a result of the selection, the SDK widget will generate a Deep Link to open.
- The Merchant opens the link from the
payloadparameter in WebView. Just like when using the payment form via WebView, when openingpayloadvia WebView, the JS SBP widget is launched to form a direct Deep Link on bank selection. After that, the Deep Link should be followed.
- On the Merchant's payment form in a web browser: the Merchant displays the QR code from the
The Customer scans the QR code using specialized software or (in case of a mobile app) makes a payment in the selected bank's app.
The Payment Gateway receives a response with the payment result.
-
If the payment is not successful, then the number of payment attempts is reduced and the Payment Gateway sends a callback about the unsuccessful payment to the Merchant’s system.
If the payment is successful, Steps 13–14 are skipped and the scenario goes to Step 15.
If the Merchant is configured to send notifications (callbacks, email), then a notification is sent to the Customer about unsuccessful payment for the order.
The Merchant requests the payment status from the Payment Gateway – sbp/c2b/qr/dynamic/status.do.
The Payment Gateway returns a callback with the payment status.
If the Merchant is configured to send notifications (callbacks, email), then a notification is sent to the Customer about successful payment for the order.
Merchants sends order status request getOrderStatusExtended.do to the Payment gateway.
The Payment gateway returns order status.
Customer identification
To identify a Customer before payment, the Merchant:
- enables the corresponding permission by contacting the support team;
- requests from the Customer the data to be used for identification: the full name and the telephone number of the Customer.
Then, a dynamic QR code is generated for payment (step 2) with Customer data. This code should be used for payment.
On payment processing, Payment gateway compares the data specified during QR code generation:
- Payer's full name
- Payer's phone number and/or
- identifier of the Payer's bank (BIC)
with Customer's data. If they are the same (Payer=Customer), then Payment gateway confirms the possibility of order payment.
If at least one parameter differs, the payment is declined.
If none of the three parameters (full name, phone number, BIC) of the Payer is specified when requesting the order registration (step 2), the parameters are not transferred and the order registration and payment are performed without prior identification of the Customer.
Payment via "instant invoice" service
Payment via "instant invoice" service is possible on the payment page or on the Merchant's side.
The payment scenario is similar to the Payment on the payment page scenario.
If this functionality is enabled, the QR code displayed in the Customer's mobile app is also a link. For payment, the customer clicks the QR code instead of scanning it, and the online bank is opened.
At the merchant's request, the use of "instant invoice" functionality can be replaced by using of NSPK widget. In this case, when the customer chooses SBP on a mobile device, the QR code is not displayed, and the link is opened allowing to choose the bank for payment.
Cancellation and refund
Cancellation of a payment request
- The client wishes to cancel the order/payment using the already created QR code.
- The Merchant sends a request to the Payment Gateway to cancel the QR code sbp/c2b/qr/dynamic/reject.do, passing
mdOrderand `qrId`. - The Payment Gateway checks whether the QR code can be canceled.
- The Payment Gateway requests the status of the QR code.
- NSPK sends a response: QR status = ACWP (see Order statuses).
If the response has a different status, go to Step 8. 6. The Payment Gateway assigns the order status = Deposited. 7. The Payment Gateway sends a response with a cancellation error. 8. NSPK sends a response: QR status = RCVD (see Order statuses).
If the response has a different status, go to Step 10. 9. The Payment Gateway sends a response with a cancellation error. 10. NSPK sends a response: QR status = RJCT or NTST (see Order statuses). 11. The Payment Gateway updates the QR code status: Status: QR=REJECTED_BY_USER. 12. The Payment Gateway sends a response with a successful cancellation. 13. NSPK sends a notification of successful payment 14. NSPK sends a response with the status QR = ACWP (see Order statuses). 15. The payment gateway requests an auto-refund. 16. NSPK notifies the Payment Gateway about the successful refund.
After canceling the QR code, the order can again be paid using any previously available payment methods, including restarting SBP C2B payment by registering a new QR code.
| Status | Description |
|---|---|
| NTST | NOT STARTED. Assigned when QR code is created |
| RCVD | RECIEVED. Operation in progress, Customer scanned the QR code |
| ACWP | ACCEPTED. The operation is completed, the payment was successful |
| RJCT | REJECTED. Operation was cancelled. Counts as a payment attempt |
Refund via API
status=[PENDING, REJECT] alt if status is REJECT Payment Gateway-->>Merchant:6. Refund execution error else if status is PENDING Payment Gateway->>Payment Gateway:7. Waiting for the final status NSPK-->>Payment Gateway:8. Сallback notification with the result of the refund alt if status is ACCEPTED Payment Gateway-->>Merchant: 9. Successful refund else if status is REJECT Payment Gateway-->>Merchant: 10. Refund execution error else if no callback notification with the result of the refund is received in 10 sec Payment Gateway-->>Merchant: 11. Refund is in progress end opt Merchant can get the refund status by resending request for the refund Merchant->>Payment Gateway: 12. Request for the refund Payment Gateway->>Payment Gateway: 13. Order status
PENDING Payment Gateway->>NSPK: 14. Request for refund status NSPK-->>Payment Gateway: 15. Response
status=[ACCEPTED, REJECT, PENDING] Payment Gateway->>Payment Gateway: 16. Order status update alt if status is ACCEPTED Payment Gateway-->>Merchant: 17. Successful refund else if status is REJECT Payment Gateway-->>Merchant: 18. Refund execution error else if status is PENDING Payment Gateway-->>Merchant: 19. Refund is in progress end end end
- The Merchant sends a request for a refund to the Payment Gateway – refund.do.
- The Payment Gateway sends a request to NSPK for the possibility of a refund.
- NSPK sends a response to the request.
- The Payment Gateway sends a request for a refund to NSPK.
- In response, NSPK sends the refund status to the Payment Gateway:
PENDINGorREJECT.
If the refund status isREJECT, go to Step 6.
If the refund status isPENDING, go to Step 7. - The Payment Gateway sends an error response to the Merchant with a corresponding message in the
errorMessageparameter. - The Payment Gateway is awaiting the final refund status from NSPK.
- NSPK sends a callback to the Payment Gateway with the result of the refund:
ACCEPTEDorREJECT.
If the status isACCEPTED, go to Step 9.
If the status isREJECT, go to Step 10.
If no callback notification is received within the time interval set in the Payment Gateway settings, go to Step 11. - The Payment Gateway returns a response with the error code
0to the Merchant. The script is being completed. - The Payment Gateway sends an error response to the Merchant with a corresponding message in the
errorMessageparameter. The script is being completed. - The Payment Gateway sends an error response to the Merchant with a corresponding message in the
errorMessageparameter. In this case, the following steps starting from Step 12 are taken in order to get the refund status. - The Merchant resends the request for the refund to the Payment Gateway - refund.do.
- Upon receiving a repeated request, the Payment Gateway checks the refund status -
PENDING. - The Payment Gateway sends a request for the refund status to NSPK.
- NSPK sends a response to the request -
ACCEPTED,REJECT,PENDING. - The Payment Gateway updates the refund status.
If the status isACCEPTED, go to Step 17.
If the status isREJECT, go to Step 18.
If the status isPENDING, go to Step 19. - The Payment Gateway returns a response with the error code
0to the Merchant. - The Payment Gateway sends an error response to the Merchant with a corresponding message in the
errorMessageparameter. - The Payment Gateway sends an error response to the Merchant with a corresponding message in the
errorMessageparameter.
Refund via Personal Area
In case of the Customer's refusal to receive the goods (services) or its return, partial or full refund to the Customer's card is possible . The refund operation is performed after debiting the Customer's account. During the refund operation, you can specify the amount less or equal to the debited amount. The refund amount is specified in minor currency units. The operation is applicable to the orders in Deposited and Refunded statuses.
Partial refund is available as many times as you like until the entire order amount is refunded.
This function is available to Merchants with the corresponding permissions (coordinated with the bank). The refund button is available only to the users with a corresponding permission.
See the description of refund in Merchant Portal here.
Autorefund
operation status NSPK-->>Payment Gateway:Response:
status=ACWP Payment Gateway->>NSPK:Request for refund of the SBP
operation NSPK->>NSPK: Refund NSPK-->>Payment Gateway: Notification about
final refund status Payment Gateway->>Payment Gateway: Storing event
in the order history Payment Gateway-->>Merchant: Callback notification
with the refund information Merchant-->>Payment Gateway: Request for order status
getOrderStatusExtended.do. Payment Gateway-->>Merchant: Response
- Order status changes to
DECLINED. - Payment Gateway requests SBP C2B operation in NSPK.
- NSPK returns the operation status
status=ACWP. - Payment Gateway requests refund for SBP C2B operation.
- NSPK performs refund for the operation.
- NSPK returns the notification about the final refund status to Payment Gateway.
- Payment Gateway stores the refund event in the order history.
- Payment Gateway sends callback notification with the refund information to the Merchant (the notification contains the operation type
operation=refundand the indicator of successful operationstatus=1). - Merchant requests the order status, sending the getOrderStatusExtended.do request to Payment Gateway.
- Payment Gateway returns the order information.
Refund of the order payed via CL
For refund of the order payed via CL, use standard scenario.
Autorefund
operation status NSPK-->>Payment Gateway:Response:
status=ACWP Payment Gateway->>NSPK:Request for refund of the SBP
operation NSPK->>NSPK: Refund NSPK-->>Payment Gateway: Notification about
final refund status Payment Gateway->>Payment Gateway: Storing event
in the order history Payment Gateway-->>Merchant: Callback notification
with the refund information Merchant-->>Payment Gateway: Request for order status
getOrderStatusExtended.do. Payment Gateway-->>Merchant: Response
- Order status changes to
DECLINED. - Payment Gateway requests SBP C2B operation in NSPK.
- NSPK returns the operation status
status=ACWP. - Payment Gateway requests refund for SBP C2B operation.
- NSPK performs refund for the operation.
- NSPK returns the notification about the final refund status to Payment Gateway.
- Payment Gateway stores the refund event in the order history.
- Payment Gateway sends callback notification with the refund information to the Merchant (the notification contains the operation type
operation=refundand the indicator of successful operationstatus=1). - Merchant requests the order status, sending the getOrderStatusExtended.do request to Payment Gateway.
- Payment Gateway returns the order information.
Two-phase payments with SBP
An order is considered a two-phase if it is registered with registerPreAuth.do method.
SBP does not support two-phase payments, but it is possible to pay for two-phase orders via the SBP through the Payment Gateway. This requires a specific permission in the Payment Gateway. This permission will not make the payment two-phase, it only allows you to pay for a two-phase order using the usual SBP payment.
A two-phase order paid via SBP is captured immediately after payment: its status becomes DEPOSITED (not APPROVED, as would be at a regular two-phase payment). In this case, the funds will be are immediately debited from the Client's account; you do not need to capture the order in the Merchant Portal or execute deposit.do.
To cancel such orders, use the Refund option in the Merchant Portal or the refund.do method as shown in Refund section.
Example
A gas station uses a two-phase payment to pre-authorize funds on the customer's account and then capture the amount for the actual fuel dispensed (it may differ from the pre-authorized amount).
In the gas station's app, the customer can pay for orders by card or via SBP. It is not known in advance which payment method the customer will choose. Therefore, the order is registered as a two-phase order; after paying by card, the standard capture operations are performed. But if the customer decides to pay for the order via SBP, then the funds are immediately debited from the account (/deposit.do is not required), and /refund.do is used to adjust the amount.
Payment via dynamic UPC
To work with dynamic QR code (universal payment code, UPC) contact the Bank for enabling the corresponding setting. If the setting is enabled, you can pay using SBP and the Digital Ruble.
Integration for this payment method is similar to SBP integration. You can find the description of integration schemes in the Payment via dynamic QR code section.
API methods
See API methods description here.
Callback notifications
Callback notifications are sent to the Merchant in the following cases:
When a credential is stored
When a credential is stored with or without payment, a Callback notifications is sent to the Merchant.
If storing a credential with payment or storing a credential without payment fails, Payment Gateway sends a callback notification to the Merchant, passing NSPK code in the sbp.c2b.operation.nspkCode parameter.
Example of callback notification for storing a credential, status=1
https://test.com/callback?amount=1000&orderNumber=136007&checksum=4BE878188646A0BEEA459F14FF9D9BEFE09D25E3945B98959BBC7B9D6B6941D0&mdOrder=03013b49-ecba-7792-806a-03f80203b80c&operation=bindingCreated&refundedAmount=0&memberId=100000000008&status=1If the merchant has passed subscriptionServiceName (name of the service provided) and/or subscriptionServiceId (identifier of the service provided) in the request of QR code (get.do), the callback notification contains these parameters.
When a stored credential payment fails
When a stored credential payment fails, Payment Gateway sends a callback notification to the Merchant, passing NSPK code in the sbp.c2b.operation.nspkCode parameter.
The information about the failure is stored in the order history.
Example of callback notification for stored credential payment failure, status=0, sbp.c2b.operation.nspkCode=RQ05031
https://test.com/callback?sbp.c2b.operation.nspkCode=RQ05031&amount=10000&orderNumber=169008&mdOrder=036d42d3-78c3-77a9-af76-49fa00a3e120&operation=deposited&status=0If the merchant has passed subscriptionServiceName (name of the service provided) and/or subscriptionServiceId (identifier of the service proveded) in the request of QR code (get.do), the callback notification contains these parameters.
Response codes from NSPK
| Response code | Description |
|---|---|
| RQ05031 | Refusal of the Paying Bank. Stored credential not found |
| RQ05032 | Refusal of the Paying Bank to perform payment |
| RQ05060 | Insufficient funds to carry out the operation |
| RQ05061 | SBP operation amount limit exceeded |
| RQ05062 | SBP operation number limit exceeded |
| RQ05063 | Suspicion of fraud |
| RQ05064 | Performing operations in this Merchant category is prohibited |
| RQ05065 | Account is blocked |
| RQ05066 | Account is closed |
| RQ05067 | Performing operation is prohibited by law |