# Testing payments via SBP

Features of the SBP payment service in the test environment:

  • A request for a list of banks returns a list of 5 banks;

  • For a successful request with full NAME and receiving the payment status of success, you must use the phone number +79001234567, if using a different phone, the transaction status fail will be received;

  • For a successful request without full NAME and receiving the payment status of success, you must use the phone number +79007654321, if using a different phone, the transaction status fail will be received. The response to the status request returns the full name Ivan Ivanovich Ivanov;

# Getting a list of banks

Authorization - XAuth (opens new window).

Parameter Type Required Description
bankName string No The name of the bank by which to filter, you can specify an incomplete name, the method will return all suitable options. Case is ignored when filtering

Request for a list of banks:

GET https://secure.mandarinpay.com/api/sbp/banks/

Response if the request was successfully created:

{
    "banks": [
        {
            "bankId": "100000000008",
            "bankName": "Альфа-Банк",
            "bankBic": "044525593"
        },
        {
            "bankId": "100000000005",
            "bankName": "ВТБ",
            "bankBic": "044525187"
        },
        {
            "bankId": "100000000004",
            "bankName": "Т-Банк",
            "bankBic": "044525974"
        },
        {
            "bankId": "100000000007",
            "bankName": "Райффайзен Банк",
            "bankBic": "044525700"
        },
        {
            "bankId": "100000000111",
            "bankName": "Сбербанк",
            "bankBic": "044525225"
        }
    ]
}

Request to get a specific bank:

GET https://secure.mandarinpay.com/api/sbp/banks?bankName=Сбербанк

Response if the request was successfully created:

{
    "banks": [
        {
            "bankId": "100000000111",
            "bankName": "Сбербанк",
            "bankBic": "044525225"
        }
    ]
}

# Payment with full name

Parameter Required
customerInfo Yes
customerInfo.phone Yes
customerInfo.email Yes
customerInfo.firstName Yes
customerInfo.lastName Yes
customerInfo.middleName Yes
payment Yes
payment.action Yes
payment.orderId Yes
payment.price Yes
target Yes
target.sbp Yes
target.sbp.bankId Yes
target.sbp.bankBic Yes

Request:

POST https://secure.mandarinpay.com/api/transactions
{
    "customerInfo": {
        "phone": "+79001234567",
        "email": "test@test.com",
        "firstName": "Иванов",
        "lastName": "Иван",
        "middleName": "Иванович"
    },
    "payment": {
        "orderId": "your_unique_order_id",
        "price": "10.00",
        "action": "payout"
    },
    "target": {
        "sbp": {
            "bankId": "100000000111",
            "bankBic": "044525225"
        }
    }
}

Response in case of successful transaction creation (200 OK):

{
	"id": "43913ddc000c4d3990fddbd3980c1725"
}

Response in case of transaction not created (400 Bad request):

{
	"error": "Invalid request"  
}

Response in case of attempt to create payment with already existing value orderId (400 Bad Request):

{
    "error": "Duplicate order id 5f2fdcf6-0b78-4dd7-be9f-212c7c058001 found for incomplete payout transaction",
    "errorCode": -2
}

# Payment without full name

Payments without full name require confirmation or cancellation after transaction creation.

Parameter Required
customerInfo Yes
customerInfo.phone Yes
customerInfo.email Yes
payment Yes
payment.action Yes
payment.orderId Yes
payment.price Yes
target Yes
target.sbp Yes
target.sbp.bankId Yes
target.sbp.bankBic Yes

Request:

POST https://secure.mandarinpay.com/api/transactions
{
    "customerInfo": {
        "phone": "+79007654321",
        "email": "test@test.com"
    },
    "payment": {
        "orderId": "your_unique_order_id",
        "price": "10.00",
        "action": "payout"
    },
    "target": {
        "sbp": {
            "bankId": "100000000111",
            "bankBic": "044525225"
        }
    }
}

Response in case of successful transaction creation (200 OK):

{
	"id": "43913ddc000c4d3990fddbd3980c1725"
}

Response in case of transaction not created (400 Bad request):

{
	"error": "Invalid request"  
}

Response in case of attempt to create payment with already existing value orderId (400 Bad Request):

{
    "error": "Duplicate order id 5f2fdcf6-0b78-4dd7-be9f-212c7c058001 found for incomplete payout transaction",
    "errorCode": -2
}

# Checking the status of a request without full name

Request for status check:

After creating a payment without a full name, you need to check the status. If the phone number specified is a test one from the documentation, the status will be success. If something else is specified, the status request will be fail.

GET https://secure.mandarinpay.com/api/sbp/43913ddc000c4d3990fddbd3980c1725/status

Response if successful:

{
    "status": "success",
    "fio": "Иван Иванович Иванов"
}

Response in case of failure:

{
    "status": "fail",
    "fio": null
}

# Payment confirmation without full name

Request for payment confirmation:

After receiving a successful status, you must confirm the payment so that the recipient receives the funds.

POST https://secure.mandarinpay.com/api/sbp/43913ddc000c4d3990fddbd3980c1725/confirm

Response in case of successful payment confirmation (200 OK):

# Cancellation of payment without full name

Payment can be cancelled if the confirmation request confirm has not yet been sent.

Request to cancel payment:

POST https://secure.mandarinpay.com/api/sbp/43913ddc000c4d3990fddbd3980c1725/reject

Response in case of successful cancellation of payment (200 OK):

{
	"id": "43913ddc000c4d3990fddbd3980c1725"
}