Skip to main content

Payout in a foreign currency

This scenario describes payout transactions initiated in a currency other than Russian rubles, for example, EUR or USD. However, the payout itself will be processed by Bank 131 and made in Russian rubles, calculated as of today's currency exchange rate. The currency exchange rates displayed are provided for information purposes only and do not constitute the real exchange rates.

You are eligible to make payouts in the following foreign currencies:

  • EUR
  • USD

Before making payouts in a foreign currency, please contact your manager in Bank 131.

Step 1. Start a payout

Send a request for payment session creation session/create, then a separate request for payout creation using this session's identifier session/start/payout. In the EncryptedCard pass the tokenized bank card details obtained from the widget.

You can find information about the token or card through the token/info method. This includes receiving the last 4 numbers of the card, in order to show the user the payment destination.

The exact set of mandatory parameters depends on the recipient's card type.

If you are sending money to a Russian bank card, you will need the following:

  • card number;
  • recipient's name;
  • amount in ruble decimal format (e.g. if you are paying 100 EUR or USD, you need to pass 10000).

View the parameters for payouts to Russian cards

Шаг 2. Wait for a confirmation that Bank 131 is ready to perform the payout

Note that autoconfirmation is not applicable for this payout scenario. You should wait for the confirmation webhook instead.

Bank 131 will send you the mandatory ready_to_confirm webhook (using the webhooks address you provided to your Bank 131 manager previously). This means that the payout can be performed and the Bank is waiting for you to confirm (or cancel). The webhook body will contain all the details of the payout, including the amount in Russian rubles.

You then reply with the 200 HTTP code.

Webhook example: ready_to_confirm

curl -X POST \
https://partner.ru \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-SIGN: a4f1698616d6ad7b8b73a9d72d281eeb443b64dee3f38df430eeed6aa29e1dc' \
-d '{
"type": "ready_to_confirm",
"session": {
"id": "3230",
"status": "in_progress",
"created_at": "2018-05-27T02:03:00.000000Z",
"updated_at": "2018-05-27T02:03:00.000000Z",
"next_action": "confirm",
"payments": [
{
"id": "2018",
"status": "pending",
"created_at": "2018-05-27T02:03:00.000000Z",
"customer": {
"reference": "user123",
"contacts": [
{
"email": "user@gmail.com"
}
]
},
"payment_method": {
"type": "card",
"card": {
"last4": "4242",
"brand": "visa"
}
},
"amount_details": {
"amount": 7550,
"currency": "rub"
},
"metadata": "good"
}
]
}
}'

An example of handling a webhook using SDK

use Bank131\SDK\Client;
use Bank131\SDK\Config;
use Bank131\SDK\Services\WebHook\Hook\WebHookTypeEnum;

$config = new Config(
'https://demo.bank131.ru',
'your_project_name',
file_get_contents('/path/to/your/private_key.pem'),
file_get_contents('/path/to/bank131/public_key.pem')
);

$client = new Client($config);

$hook = $client->handleWebHook('sign from headers', 'request body');

if ($hook->getType() === WebHookTypeEnum::READY_TO_CONFIRM) {
//do your logic here
}

Шаг 3. Confirm or cancel the payout

Check the payout details and confirm that you are ready to perform the payout using confirm_request or cancel it using cancel_request. Note that the confirm_request request constitutes an order for Bank 131 to make the payout in Russian rubles, strictly according to the value passed within the ready_to_confirm webhook body.

Request example: confirm_request

curl -X POST \
https://demo.bank131.ru/api/v1/session/confirm \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: 6eaf1e9cfa15f011e02c0a126187fe327a71e9d79be5e3fdb3f69dc5dfcd9872' \
-d '{
"session_id": "3230"
}'

Request example: cancel_request

curl -X POST \
https://demo.bank131.ru/api/v1/session/cancel \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: 6eaf1e9cfa15f011e02c0a126187fe327a71e9d79be5e3fdb3f69dc5dfcd9872' \
-d '{
"session_id": "3230"
}'