Single-request payouts
You can send a payout to a bank account within a single request, without any intermediate steps. In this case, you need to comply with all the PCI DSS requirements.
To enable singe-request payouts, contact your account manager. Once this option is enabled, all your payouts will be processed this way. To disable it, contact your account manager again.
Step 1. Create a session along with a payout
Send a session/init/payout request, specifying the parameters for payouts with open data.
Request example
- cURL
- PHP
curl -X POST \
https://demo.bank131.ru/api/v1/session/init/payout \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-SIGN: signature' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-d'{
"payment_method": {
"type": "bank_account",
"bank_account": {
"system_type": "ru",
"ru": {
"bik": "044525971",
"account": "40817810100000270411",
"full_name": "Иванов Иван Иванович",
"description": "Перевод средств по договору № 5015553111 Иванов Иван Иванович НДС не облагается"
}
}
},
"amount_details": {
"amount": 10000,
"currency": "rub"
},
"metadata": "good"
}'
use Bank131\SDK\API\Request\Builder\RequestBuilderFactory;
use Bank131\SDK\Client;
use Bank131\SDK\Config;
use Bank131\SDK\DTO\BankAccount\BankAccountRu;
$config = new Config(
'https://demo.bank131.ru',
'your_project_name',
file_get_contents('/path/to/your/private_key.pem')
);
$client = new Client($config);
$request = RequestBuilderFactory::create()
->initPayoutSession()
->setBankAccount(
new BankAccountRu(
'044525971',
'40817810100000270411',
'Иванов Иван Иванович',
'Перевод средств по договору № 5015553111 Иванов Иван Иванович НДС не облагается'
)
)
->setAmount(1000, 'rub')
->setMetadata('good')
->build();
$response = $client->session()->initPayout($request);
Step 2. Wait for a webhook with the payout results
Bank 131 will send you a payment_finished webhook. The result of the payout can be found in the status field of the payments/payout_list object.
If the status is succeeded, then the payout was successful. If the status is failed, then an error occurred during the payout.
More about the payout statuses >
Webhook example
curl -X POST \
https://partner.ru \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-SIGN: signature' \
-d '{
"type": "payment_finished",
"session": {
"id": "ps_3230",
"status": "accepted",
"created_at": "2018-05-27T02:03:00.000000Z",
"updated_at": "2018-05-27T02:03:00.000000Z",
"payments": [{
"id": "po_2018",
"status": "succeeded",
"created_at": "2018-05-27T02:03:00.000000Z",
"customer": {
"reference": "user123",
"contacts": [{
"email": "user@gmail.com"
}]
},
"payment_method": {
"type": "bank_account",
"bank_account": {
"system_type": "ru",
"ru": {
"bic": "044525971",
"account": "40817810100000270411",
"full_name": "Иванов Иван Иванович",
"description": "Перевод средств по договору № 5015553111 Иванов Иван Иванович НДС не облагается"
}
}
},
"amount_details": {
"amount": 10000,
"currency": "rub"
},
"metadata": "good"
}]
}
}'