Skip to content

Recurring SBP payments let you automatically charge a customer's bank account without their repeated involvement. The account is identified by a token issued during the initial binding.

Contact your 1Payment account manager to enable this feature for your project.

How it works

The SBP subscription flow consists of four steps:

  1. Account binding (first request) — you complete a successful payment with an amount greater than 0 and subscribe=1 via the payment form or GATE. The payer confirms binding in the bank app.
  2. Receiving the token — after bank confirmation, 1Payment sends a callback with a unique token. Store it for subsequent charges.
  3. Automatic charge (recurring) — for repeat payments, your server calls GATE (init_payment) with the stored token. The charge completes without payer involvement.
  4. Notification — after each charge attempt, a callback arrives with the final transaction result.

Technical details

StageEndpointMethods
Subscription registration (form)https://api.1payment.com/init_formGET, POST
Subscription registration (GATE)https://api.1payment.com/init_paymentGET, POST
Recurring charge (GATE)https://api.1payment.com/init_paymentPOST (recommended), GET

Response format: JSON. For SBP, specify payment_type=sbp in requests.

1. Subscription registration (first request)

To register a subscription, complete a successful payment with an amount greater than 0 and subscribe=1. See Form payment creation and Host-to-host payment creation (GATE) for form and GATE parameters. Below is the required set for binding.

Required parameters (initiation)

ParameterTypeDescription
partner_idIntegerYour unique ID in the 1Payment system.
project_idIntegerYour project identifier.
amountNumberPayment amount for binding — greater than 0 (for example, 50.00).
subscribeIntegerSubscription creation flag. Always 1.
payment_typeStringFor SBP, always sbp.
user_dataStringYour unique order ID for matching.
shop_urlStringURL of the site where the purchase is made.
signStringRequest signature (see below).

Optional parameters (initiation)

ParameterTypeDescription
descriptionStringSubscription description for the customer.
success_urlStringCustomer redirect URL on success.
failure_urlStringCustomer redirect URL on error.
user_idStringPayer ID in your system.

Signature for form registration — prefix init_form. Via GATE — prefix init_payment.

MD5(init_form + <параметры_без_sign_в_алфавитном_порядке_через_&> + <API_KEY>)
MD5(init_payment + <параметры_без_sign_в_алфавитном_порядке_через_&> + <API_KEY>)

2. Recurring charge (repeat payments)

To charge automatically, send a GATE request with the stored token. With an active subscription, customer involvement is not required.

Required parameters (recurring)

ParameterTypeDescription
partner_idIntegerYour unique ID in the 1Payment system.
payment_typeStringAlways sbp.
project_idIntegerYour project identifier.
amountNumberAmount of the recurring charge (for example, 50.00).
tokenStringToken received during subscription registration (from the callback).
user_dataStringNew unique transaction ID.
shop_urlStringURL of the payment source site.
signStringRequest signature (prefix init_payment).

Signature generation (sign)

MD5(init_payment + <параметры_без_sign_в_алфавитном_порядке_через_&> + <API_KEY>)

Signature verification (recurring charge)

Signature check for {{method}}

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

Parameter string: amount=500.00&partner_id=1234&payment_type=sbp&project_id=5678&shop_url=http://myshop.ru&token=sbp_t_1a2b3c&user_data=sbp_order_888
String for MD5: init_paymentamount=500.00&partner_id=1234&payment_type=sbp&project_id=5678&shop_url=http://myshop.ru&token=sbp_t_1a2b3c&user_data=sbp_order_888
Expected signature: c56ee7e986fa478392060c581bcf9ee1
Signature does not match

Request examples

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

// 1. Инициация подписки (первичная привязка)
async function setupSbpSubscription(apiKey, params) {
  const sortedKeys = Object.keys(params).sort();
  const queryString = sortedKeys.map((k) => `${k}=${params[k]}`).join('&');

  const baseString = `init_form${queryString}${apiKey}`;
  params.sign = crypto.createHash('md5').update(baseString).digest('hex');

  const response = await axios.post('https://api.1payment.com/init_form', params);
  return response.data; // ссылка для подтверждения в приложении банка
}

// 2. Рекуррентное списание (по токену)
async function chargeSbpByToken(apiKey, params) {
  const sortedKeys = Object.keys(params).sort();
  const queryString = sortedKeys.map((k) => `${k}=${params[k]}`).join('&');

  const baseString = `init_payment${queryString}${apiKey}`;
  params.sign = crypto.createHash('md5').update(baseString).digest('hex');

  const response = await axios.post('https://api.1payment.com/init_payment', params);
  return response.data;
}

const secretKey = process.env.ONEPAYMENT_API_KEY;

// Пример: привязка
const setupData = {
  partner_id: 1234,
  project_id: 5678,
  amount: '50.00',
  subscribe: 1,
  payment_type: 'sbp',
  user_data: 'sbp_setup_777',
  shop_url: 'http://myshop.ru',
};
// setupSbpSubscription(secretKey, setupData).then(console.log);

// Пример: списание
const recurringData = {
  partner_id: 1234,
  payment_type: 'sbp',
  project_id: 5678,
  token: 'sbp_t_1a2b3c',
  amount: '500.00',
  user_data: 'sbp_order_888',
  shop_url: 'http://myshop.ru',
};
chargeSbpByToken(secretKey, recurringData).then(console.log);

API response

On a successful recurring request (200):

{
  "order_id": "8p3brmb19gfg0sg8gcwhws8kgc748s87",
  "status": 2,
  "status_description": "PENDING"
}

For form registration, the response includes url (see Form payment creation); via GATE — redirect_url (see Host-to-host payment creation (GATE)).

Request error (400):

{
  "error_code": 2
}

Status notifications (callbacks)

On successful binding or charge, the system sends a POST request in JSON format to your notify_url.

ParameterTypeReq.Description
payment_typeStringYesPayment type (sbp).
order_idStringYesPayment ID in the 1Payment system.
project_idIntegerYesYour project ID.
statusIntegerYesState: 3 (success), 4 (failure).
status_descriptionStringYesSUCCESS or FAILURE.
init_timeStringYesPayment creation time.
status_timeStringYesTime the final status was received.
merchant_priceNumberYesAmount for the payer.
init_priceNumberYesAmount at initiation.
user_priceNumberYesAmount credited to the partner.
currencyStringYesCurrency (ISO 4217).
accountStringYesFor SBP — sbp.
user_dataStringYesYour transaction ID passed at creation.
signStringYesCallback signature.
tokenStringNoToken for subsequent charges — store it during binding.
testIntegerNo1 for test transactions.
status_codeStringNoDecline reason code.

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 parameters in alphabetical order joined by & + API_KEY (without the init_payment prefix). See API request format.

Was this article helpful?