# SBP payout

This method initiates a **payout via SBP** (Faster Payments System). Send a request to the `init_payout` endpoint with `payout_type=sbp`. The final status is sent to `notify_url` configured in the project payout settings; you can also poll status via [Payout status](/en/pages/payouts/status).

Request and signature format — see [API request format](/en/pages/init-request).

## How it works

1. **Request** — your server sends a signed request to `init_payout` with the SBP recipient identifier and bank `bank_id`.
2. **Response** — the API returns `order_id` and initial `status` (`2`, `PENDING`).
3. **Processing** — the system processes the payout.
4. **Notification (callback)** — the final status is sent as **POST** JSON to your `notify_url`.


See [Transaction statuses](/en/pages/transaction-statuses) for `status` and `status_description` codes.

## Technical details

|  |  |
|  --- | --- |
| **Endpoint** | `https://api.1payment.com/init_payout` |
| **Methods** | `GET`, `POST` |
| **Response format** | JSON |
| **Payout type** | The request must include `payout_type=sbp` (see [Payout types](/en/pages/payout-types)) |


## Request parameters

### Required

| Parameter | Type | Description |
|  --- | --- | --- |
| `payout_type` | String | Always `sbp`. |
| `partner_id` | Integer | Your unique ID in the 1Payment system. |
| `project_id` | Integer | Your project identifier. |
| `amount` | Number | Payout amount: strictly **from 10 to 15000** (in the project currency). |
| `destination` | String | SBP participant identifier (for example, phone number `79261234567`). |
| `bank_id` | String | Bank identifier, **12 characters**. Bank list — on the [NSPK website](https://qr.nspk.ru/proxyapp/c2bmembers.json): use the `schema` field value **without** the `bank` prefix. Example for Sberbank: `100000000111`. |
| `user_data` | String | Your internal payout ID (unique on the partner side). |
| `sign` | String | Request signature (see the Signature section). |


## Signature (`sign`)

Signature: MD5, lowercase (hex). General rules — [API request format](/en/pages/init-request#%D0%BF%D0%BE%D0%B4%D0%BF%D0%B8%D1%81%D1%8C-%D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81%D0%B0-sign).

**Formula:**


```text
MD5(init_payout + <params_excluding_sign_in_alphabetical_order_joined_with_&> + <API_KEY>)
```

**Example string before hashing** (minimal field set from archived documentation):


```text
init_payoutamount=50&destination=79261234567&partner_id=1234&payout_type=sbp&project_id=5678&user_data=1secret_key
```

If you pass `bank_id` and other fields, they participate in the signature string in alphabetical order.

### Verify signature in the documentation

## Request examples

Node.js

```javascript
const crypto = require('crypto');
const axios = require('axios');

async function createSbpPayout(apiKey, params) {
  // 1. Сортируем параметры по алфавиту
  const sortedKeys = Object.keys(params).sort();
  const queryString = sortedKeys.map((key) => `${key}=${params[key]}`).join('&');

  // 2. Подпись с префиксом init_payout
  const baseString = `init_payout${queryString}${apiKey}`;
  params.sign = crypto.createHash('md5').update(baseString).digest('hex');

  // 3. GET-запрос
  const response = await axios.get('https://api.1payment.com/init_payout', { params });
  return response.data;
}

const apiKey = process.env.ONEPAYMENT_API_KEY;
const data = {
  payout_type: 'sbp',
  partner_id: 1234,
  project_id: 5678,
  amount: 50,
  destination: '79261234567',
  bank_id: '100000000111',
  user_data: '1',
};

createSbpPayout(apiKey, data).then(console.log);
```

Python

```python
import hashlib
import os
import requests

def create_sbp_payout(api_key: str, params: dict) -> dict:
    # 1. Сортировка параметров по алфавиту
    sorted_keys = sorted(params.keys())
    query_string = "&".join(f"{k}={params[k]}" for k in sorted_keys)

    # 2. Подпись init_payout
    base_string = f"init_payout{query_string}{api_key}"
    params["sign"] = hashlib.md5(base_string.encode("utf-8")).hexdigest()

    # 3. GET-запрос
    response = requests.get("https://api.1payment.com/init_payout", params=params)
    response.raise_for_status()
    return response.json()

api_key = os.environ["ONEPAYMENT_API_KEY"]
data = {
    "payout_type": "sbp",
    "partner_id": 1234,
    "project_id": 5678,
    "amount": 50,
    "destination": "79261234567",
    "bank_id": "100000000111",
    "user_data": "1",
}
print(create_sbp_payout(api_key, data))
```

PHP

```php
<?php

function createSbpPayout(string $apiKey, array $params): string
{
    // 1. Сортировка параметров по алфавиту
    ksort($params, SORT_LOCALE_STRING);
    $tail = '';
    foreach ($params as $k => $v) {
        if ($k === 'sign') {
            continue;
        }
        $tail .= "{$k}={$v}&";
    }
    $tail = substr($tail, 0, -1);

    // 2. Формирование подписи (префикс init_payout)
    $params['sign'] = md5('init_payout' . $tail . $apiKey);

    // 3. Запрос к API
    $url = 'https://api.1payment.com/init_payout?' . http_build_query($params);
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    curl_close($ch);

    return $response;
}

// Пример данных запроса
$apiKey = getenv('ONEPAYMENT_API_KEY');
$data = [
    'payout_type' => 'sbp',
    'partner_id' => 1234,
    'project_id' => 5678,
    'amount' => 50,
    'destination' => '79261234567',
    'bank_id' => '100000000111',
    'user_data' => '1',
];

echo createSbpPayout($apiKey, $data);
```

cURL

```bash
# 1–2. Подпись: md5("init_payout" + amount=50&destination=79261234567&partner_id=1234&payout_type=sbp&project_id=5678&user_data=1 + API_KEY)

curl -sS "https://api.1payment.com/init_payout?payout_type=sbp&partner_id=1234&project_id=5678&amount=50&destination=79261234567&user_data=1&sign=PASTE_MD5_HEX"
```

## API response

Successful response (`200`):


```json
{
  "order_id": "8p3brmb19gfg0sg8gcwhws8kgc748s87",
  "status": 2,
  "status_description": "PENDING",
  "status_code": 0
}
```

| Field | Description |
|  --- | --- |
| `order_id` | Payout ID in the 1Payment system; use for [status requests](/en/pages/payouts/status). |
| `status` | Numeric status code: `2` — pending, `3` — success, `4` — declined. |
| `status_description` | `PENDING`, `SUCCESS`, or `FAILURE`. |
| `status_code` | Decline reason code (when `status` = `4`); see [Error codes (declines)](/en/pages/decline-error-codes). |


Request error (`400`):


```json
{
  "error_code": 2
}
```

## Status notifications (callbacks)

After the payout reaches a **final** status, a **POST** notification in JSON format is sent to your `notify_url` (from project payout settings). Structure is the same as for other payouts; `payout_type` is `sbp`.

**Important:** your server must return **HTTP 200 OK**. Otherwise the system retries the callback **once per minute for 10 minutes**.

**Callback signature verification:** MD5 of all parameters in alphabetical order joined with `&` + `API_KEY` (**without** the `init_payout` prefix). See [API request format](/en/pages/init-request#%D0%BA%D0%BE%D0%BB%D0%B1%D0%B5%D0%BA%D0%B8-%D1%83%D0%B2%D0%B5%D0%B4%D0%BE%D0%BC%D0%BB%D0%B5%D0%BD%D0%B8%D1%8F) for details.

## Related sections

- [Payout status](/en/pages/payouts/status)
- [Bank card](/en/pages/payouts/card)
- [PIX](/en/pages/payouts/pix)
- [SEPA](/en/pages/payouts/sepa)
- [FPS](/en/pages/payouts/fps)
- [Payout types](/en/pages/payout-types)
- [Transaction statuses](/en/pages/transaction-statuses)
- [Error codes (API)](/en/pages/error-codes-api)
- [Error codes (declines)](/en/pages/decline-error-codes)