Host-to-host payment creation (GATE)
GATE integration lets you create a payment directly from your server and receive a ready-made payment link in the Faster Payments System (SBP). You control the UI entirely: render the link as a QR code on your site or use a Pay button that opens the customer's bank app.
How it works
The API payment flow consists of four steps:
- Initialization — your server builds a request with order parameters and sends it to the 1Payment endpoint.
- Receiving the link — the system returns a direct SBP payment link (
redirect_url). - Payment — you render the link as a QR code on your site or use it for a Pay button in the mobile version; the customer opens the bank app and confirms payment.
- Notification (callback) — after the operation status changes, we send a POST notification to your
notify_urlwith the final transaction result.
Technical details
| Endpoint | https://api.1payment.com/init_payment |
| Methods | GET, POST |
| Response format | JSON |
| Payment type | The request must include payment_type=sbp |
Request parameters
Required
These fields must be present in every request to create a payment correctly.
| Parameter | Type | Description |
|---|---|---|
partner_id | Integer | Your unique ID in the 1Payment system. |
project_id | Integer | Your project identifier. |
amount | Number | Payment amount (for example, 100.00). |
payment_type | String | For SBP, always pass sbp. |
user_data | String | Your internal order ID (returned in the callback). |
shop_url | String | URL of the site where the purchase is made. |
sign | String | Request signature (see the "Signature" section). |
Optional
Pass extended customer information or enable a subscription.
| Parameter | Type | Description |
|---|---|---|
description | String | Order description shown to the customer in the bank app. |
phone | String | Payer phone number. |
email | String | Payer email address. |
user_id | String | Customer ID in your database. |
return_url | String | URL to return the payer to after payment in the bank. |
subscribe | Integer | Pass 1 to create a token for recurring payments. |
Signature generation (sign)
Signature: MD5, lowercase (hex). General rules — API request format.
Formula:
MD5(init_payment + <параметры_без_sign_в_алфавитном_порядке_через_&> + <API_KEY>)Scenario 1 — required parameters only
Parameters: amount=50, partner_id=1, payment_type=sbp, project_id=5678, shop_url=test.com, user_data=order123.
init_paymentamount=50&partner_id=1&payment_type=sbp&project_id=5678&shop_url=test.com&user_data=order123secret_keyScenario 2 — with description
When adding description=Payment1, the field is included in the string alphabetically:
init_paymentamount=50&description=Payment1&partner_id=1&payment_type=sbp&project_id=5678&shop_url=test.com&user_data=order123secret_keySignature verification in the documentation
Signature check for {{method}}
Paste the request parameters (JSON), API key, and signature. The widget verifies them automatically.
amount=50&partner_id=1234&payment_type=sbp&project_id=5678&shop_url=https://myshop.com&user_data=inv_12345init_paymentamount=50&partner_id=1234&payment_type=sbp&project_id=5678&shop_url=https://myshop.com&user_data=inv_12345da3006268cf6b16ae39abd802cccd3a9Request examples
const crypto = require('crypto');
const axios = require('axios');
async function createSbpPayment(apiKey, params) {
// 1. Сортируем параметры по алфавиту
const sortedKeys = Object.keys(params).sort();
const queryString = sortedKeys.map((key) => `${key}=${params[key]}`).join('&');
// 2. Формируем подпись с префиксом init_payment
const baseString = `init_payment${queryString}${apiKey}`;
params.sign = crypto.createHash('md5').update(baseString).digest('hex');
// 3. Отправляем POST-запрос
try {
const response = await axios.post('https://api.1payment.com/init_payment', params);
return response.data; // order_id, status, redirect_url
} catch (error) {
console.error('Ошибка при создании платежа:', error.message);
}
}
// Пример данных запроса
const apiKey = process.env.ONEPAYMENT_API_KEY;
const data = {
partner_id: 1234,
payment_type: 'sbp',
project_id: 5678,
amount: 50.0,
user_data: 'inv_12345',
shop_url: 'https://myshop.com',
};
createSbpPayment(apiKey, data).then((result) => console.log('Ответ системы:', result));API response
Successful response (200):
{
"order_id": "8p3brmb19gfg0sg8gcwhws8kgc748s87",
"status": 2,
"status_description": "PENDING",
"redirect_url": "https://qr.nspk.ru/XXX"
}| Field | Description |
|---|---|
order_id | Unique transaction ID in the 1Payment system. |
status | Numeric state code (2 — awaiting payment). |
status_description | Text status description (PENDING, etc.). |
redirect_url | Direct SBP link: render a QR code or use it as the Pay button URL. |
Request error (400):
{
"error_code": 2
}Status notifications (callbacks)
If at payment initiation the system could not obtain redirect data, the init_payment response will not include redirect_url. In that case redirect_url arrives later on your notify_url in an intermediate status.
After the operation status changes, our server sends a POST request in JSON format to your notify_url.
| Parameter | Type | Req. | Description |
|---|---|---|---|
payment_type | String | Yes | Payment type (sbp). |
order_id | String | Yes | Payment identifier in the 1Payment system. |
project_id | Integer | Yes | Your project ID. |
status | Integer | Yes | State: 2 (pending), 3 (success), 4 (failure). |
status_description | String | Yes | PENDING, SUCCESS, or FAILURE. |
init_time | String | Yes | Payment creation time. |
status_time | String | Yes | Time the final status was received. |
merchant_price | Number | Yes | Payment amount. |
user_price | Number | Yes | Partner payout. |
currency | String | Yes | Payment currency (ISO 4217). |
account | String | Yes | SBP account details (value sbp). |
user_data | String | Yes | Transaction ID passed at initiation. |
sign | String | Yes | Callback signature. |
redirect_url | String | No | QR code URL if not sent earlier. |
status_code | String | No | Error code on decline. |
token | String | No | Subscription identifier for recurring payments. |
test | Integer | No | 1 for test operations. |
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 by & + API_KEY (without the init_payment prefix). See API request format.