Skip to content

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:

  1. Initialization — your server builds a request with order parameters and sends it to the 1Payment endpoint.
  2. Receiving the link — the system returns a direct SBP payment link (redirect_url).
  3. 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.
  4. Notification (callback) — after the operation status changes, we send a POST notification to your notify_url with the final transaction result.

Technical details

Endpointhttps://api.1payment.com/init_payment
MethodsGET, POST
Response formatJSON
Payment typeThe request must include payment_type=sbp

Request parameters

Required

These fields must be present in every request to create a payment correctly.

ParameterTypeDescription
partner_idIntegerYour unique ID in the 1Payment system.
project_idIntegerYour project identifier.
amountNumberPayment amount (for example, 100.00).
payment_typeStringFor SBP, always pass sbp.
user_dataStringYour internal order ID (returned in the callback).
shop_urlStringURL of the site where the purchase is made.
signStringRequest signature (see the "Signature" section).

Optional

Pass extended customer information or enable a subscription.

ParameterTypeDescription
descriptionStringOrder description shown to the customer in the bank app.
phoneStringPayer phone number.
emailStringPayer email address.
user_idStringCustomer ID in your database.
return_urlStringURL to return the payer to after payment in the bank.
subscribeIntegerPass 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_key

Scenario 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_key

Signature verification in the documentation

Signature check for {{method}}

Paste the request parameters (JSON), API key, and signature. The widget verifies them automatically.

Parameter string: amount=50&partner_id=1234&payment_type=sbp&project_id=5678&shop_url=https://myshop.com&user_data=inv_12345
String for MD5: init_paymentamount=50&partner_id=1234&payment_type=sbp&project_id=5678&shop_url=https://myshop.com&user_data=inv_12345
Expected signature: da3006268cf6b16ae39abd802cccd3a9
Signature does not match

Request 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"
}
FieldDescription
order_idUnique transaction ID in the 1Payment system.
statusNumeric state code (2 — awaiting payment).
status_descriptionText status description (PENDING, etc.).
redirect_urlDirect 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.

ParameterTypeReq.Description
payment_typeStringYesPayment type (sbp).
order_idStringYesPayment identifier in the 1Payment system.
project_idIntegerYesYour project ID.
statusIntegerYesState: 2 (pending), 3 (success), 4 (failure).
status_descriptionStringYesPENDING, SUCCESS, or FAILURE.
init_timeStringYesPayment creation time.
status_timeStringYesTime the final status was received.
merchant_priceNumberYesPayment amount.
user_priceNumberYesPartner payout.
currencyStringYesPayment currency (ISO 4217).
accountStringYesSBP account details (value sbp).
user_dataStringYesTransaction ID passed at initiation.
signStringYesCallback signature.
redirect_urlStringNoQR code URL if not sent earlier.
status_codeStringNoError code on decline.
tokenStringNoSubscription identifier for recurring payments.
testIntegerNo1 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.

Was this article helpful?