Single-request payment
You can send a payment as single request, with no interim steps (if you can do it without them). You will shortly get the payment result in response.
This option can work if:
- you have the PCI DSS certificate
- you don't use the payment form widget
Here, a payment with immediate capture is described. More about payments with later capture
How to enable
For such payments, there is a special method, session/init/payment/sync
. Inform the Bank 131 manager that you want to use it.
In this case, you will not receive webhooks from Bank 131. You can learn the transaction status with the request session/status
.
How to perform a payment
Send the request session/init/payment/sync
.
In the field payment_method.type
, specify the value card
. In the object BankCard
, specify user bank card details. In the field payment_options.return_url
, specify the address to which the user should be redirected after the payment is processed (it is required).
The payment result will be returned in response to the request in the field payment.status
:
succeeded
— the payment has completed successfullyfailed
— the payment has not gone through because of an errorpending
— the user needs to go through 3D Secure verification.
Payment request example
curl --location --request POST 'https://proxy.bank131.ru/api/v1/session/init/payment/sync' \
--header 'Content-Type: application/json' \
--header 'X-PARTNER-SIGN: sign' \
--header 'X-PARTNER-PROJECT: project' \
--data-raw '{
"payment_details": {
"type": "card",
"card": {
"type": "bank_card",
"bank_card": {
"number": "4242424242424242",
"expiration_month": "01",
"expiration_year": "22",
"security_code": "123"
}
}
},
"amount_details": {
"amount": 10000,
"currency": "rub"
},
"customer": {
"reference": "lucky"
},
"payment_options": {
"return_url": "https://131.ru"
}
}'
If a result is not returned
Sometimes, the final payment status is not returned in response to a request. For instance, if a payment is being processed for a very long time or the user card requires 3D Secure.
Too long payment
If payment processing lasts more than 40 seconds, the intermediate payment status, in_progress
, will be included in the response.
To learn the final payment status, send the request session/status
.
3D Secure card
If a user card requires 3D Secure, redirection details will be returned in response to the request. Redirect the user to customer_interaction.redirect.url
.
After that, send the request session/status
to learn the final payment status.