Documentation

Documentation

  • Bank 131 API
  • Languages iconEnglish
    • Русский

›How Payments Work

131 Documentation

  • API features
  • Where to begin

Introduction to API

  • Interaction
  • API libraries
  • Testing
  • Version history

How Payouts Work

  • Features
  • How it all works
  • Main payout scenario
  • Payout refunds
  • The Self-employed

    • Payouts to the self-employed
    • Linking the self-employed
    • Fiscalization

    Payout Methods

    • To a Russian bank card
    • To a Russian bank account
    • To a QIWI Wallet
    • To a YooMoney (Yandex.Money)
    • To the Russian Federal Tax Agency
    • Via FPS by a phone number

    Payout Scenarios

    • Payout to a card via widget
    • Payout from a nominal account to a bank card
    • Single-request payout
    • Payout to a card with PCI DSS
    • Payout to a self-employed person with fiscal receipt

How Payments Work

  • Features
  • Payment process
  • Payments via bank card
  • Payments with later capture
  • Refunds
  • Recurring payments
  • Payments via FPS by QR code
  • Payments via Telegram

    • How to create your Telegram bot
    • How to connect your Telegram bot
    • How to setup your Telegram bot

    Split Payments

    • Features and options
    • Split payments out of the box
    • Split payments using API

    Payment Scenarios

    • Paying via payment form
    • Paying with PCI DSS
    • Single-request payment

Widgets

  • Widget to get card details
  • Payment form widget
  • Widget for linking a self-employed person to the Bank

Passport Verification

  • Features
  • Interaction
  • Methods

    • Verification request
    • Verification status
  • Response and errors

Reports

  • Payouts report
  • Payments report
  • Monthly report

API Reference

  • Objects
  • Methods
  • Webhooks
  • Error codes

Refunds

You can return all or part of a successful payment to the sender.

How to perform a refund

Step 1. Send a refund request

To perform a refund, send the session/refund request. In the session_id field, pass the identifier of the payment session for the payment you need to refund. In amount_details.amount, specify the amount of the refund. If you leave this blank, the money will be refunded in full (i.e. for the full amount of the payment in question).

Request example

cURL
PHP
curl -X POST \
https://demo.bank131.ru/api/v1/session/refund \
-H 'Content-Type: application/json
' \
-H '
X-PARTNER-PROJECT: your_project_name' \
-H '
X-PARTNER-SIGN: sign' \
-d '
{
"session_id":"ps_3230"
}'
use Bank131\SDK\API\Request\Builder\RequestBuilderFactory;
use Bank131\SDK\Client;
use Bank131\SDK\Config;

$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()
->refundSession('ps_3230')
->build();

$response = $client->session()->refund($request);

Step 2. Wait to be notified of the results of the refund

After the refund has been issued, Bank 131 will send you the payment_refunded webhook with the results.

Webhook example: payment_refunded

    curl - X POST\
    https: //partner.ru \
        -H 'Content-Type: application/json'\ -
        H 'X-PARTNER-SIGN: a4f1698616d6ad7b8b73a9d72d281eeb443b64dee3f38df430eeed6aa29e1dc'\ -
        d '{
    "type": "payment_refunded",
    "session": {
        "id": "ps_3230",
        "status": "accepted",
        "created_at": "2018-05-27T02:03:00.000000Z",
        "updated_at": "2018-05-27T02:03:00.000000Z",
        "acquiring_payments": [{
            "id": "pm_2705",
            "status": "succeeded",
            "created_at": "2018-05-27T02:03:00.000000Z",
            "finished_at": "2018-05-27T02:03:00.000000Z",
            "customer": {
                "reference": "lucky"
            },
            "payment_details": {
                "type": "card",
                "card": {
                    "brand": "visa",
                    "last4": "4242"
                }
            },
            "amount_details": {
                "amount": 1000,
                "currency": "rub"
            },
            "metadata": "good",
            "refunds": [{
                "id": "rf_203",
                "status": "accepted",
                "created_at": "2018-05-27T02:03:00.000000Z",
                "finished_at": "2018-05-27T02:03:00.000000Z",
                "amount_details": {
                    "amount": 1000,
                    "currency": "rub"
                }
            }]
        }]
      }
    }'

An example of handling a webhook using SDK

PHP
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::PAYMENT_REFUNDED) {
$session = $hook->getSession();
//do your logic here
}
← Payments with later captureRecurring payments →
  • How to perform a refund
    • Step 1. Send a refund request
    • Step 2. Wait to be notified of the results of the refund
Documentation
Documentation
PayoutsPaymentsAPI ReferenceService documents
Step by step
Payout to a card via widgetPayout to a card with PCI DSSPayout to the self-employed Paying via payment form
Get in touch
Ideas and partnerships — partners@131.ruMedia — press@131.ru
© 2023 Bank 131