Skip to content

GATE integration lets you initiate a bank card payment directly from your server: you pass card details and order parameters to the 1Payment API. If 3-D Secure is required, the response includes redirect_url to redirect the payer.

How it works

  1. Request — your server sends payment parameters and card data to the init_payment endpoint with payment_type=card.
  2. Response — the system returns order_id, status, and if needed redirect_url for 3-D Secure.
  3. 3-D Secure — if the response contains redirect_url, redirect the payer to that address to complete payment.
  4. Notification (callback) — the final status arrives at your notify_url.

Technical information

Endpointhttps://api.1payment.com/init_payment
MethodsGET, POST
Response formatJSON
Payment typepayment_type=card is required in the request

Request parameters

Required

ParameterTypeDescription
partner_idIntegerYour unique ID in the 1Payment system.
payment_typeStringAlways card.
project_idIntegerYour project identifier.
accountStringBank card number.
card_holderStringCardholder name (as printed on the card).
yearStringCard expiry year, last two digits (for example, 22).
monthStringCard expiry month (for example, 01).
cvcStringCard CVV/CVC code.
amountNumberPayment amount in the project currency (for example, 50.00).
user_dataStringYour internal order ID (returned in the callback).
shop_urlStringURL of the website where the payment originates.
signStringRequest signature (see the "Signature" section).

Optional

ParameterTypeDescription
descriptionStringPayment description.
subscriptionIntegerFor subscription payments only: pass 1 to receive a token for recurring charges.
tokenStringBound subscription token ID.
ipStringPayer IP address.
destinationStringDestination card number (optional, for P2P scenarios).
return_urlStringURL to return the payer to after payment in the bank.
user_idStringPayer ID in your system.

3-D Secure 2.x parameters

Passed to complete 3-D Secure version 2.x.

ParameterTypeDescription
ext_notification_urlStringPayer return address after 3DS (TermUrl).
ext_browser_accept_headerStringHTTP Accept header value (max. 2048 characters).
ext_browser_color_depthStringBrowser color palette bit depth.
ext_browser_ipStringPayer browser IP address.
ext_browser_languageStringBrowser language, IETF BCP47 (max. 8 characters).
ext_browser_screen_heightStringBrowser screen height, window.screen.height (max. 6 characters).
ext_browser_screen_widthStringBrowser screen width, window.screen.width (max. 6 characters).
ext_browser_tzStringLocal time offset from UTC in minutes (max. 5 characters).
ext_browser_user_agentStringHTTP User-Agent header value (max. 2048 characters).
ext_browser_java_enabledStringWhether JavaScript is enabled: true or false.
ext_window_widthStringBrowser window width, window.innerWidth (in pixels).
ext_window_heightStringBrowser window height, window.innerHeight (in pixels).

Signature generation (sign)

Signature: MD5, lowercase (hex). General rules — API request format.

Formula:

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

Example string before hashing:

init_paymentaccount=4111111111111111&amount=50&card_holder=TEST&cvc=111&description=test_payment&month=01&partner_id=1234&payment_type=card&project_id=5678&year=22secret_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: account=4111111111111111&amount=50&card_holder=TEST&cvc=111&description=test_payment&month=01&partner_id=1234&payment_type=card&project_id=5678&shop_url=https://test.com&user_data=order_777&year=22
String for MD5: init_paymentaccount=4111111111111111&amount=50&card_holder=TEST&cvc=111&description=test_payment&month=01&partner_id=1234&payment_type=card&project_id=5678&shop_url=https://test.com&user_data=order_777&year=22
Expected signature: bc2592ca4405860b254b7c07d56a095a
Signature does not match

Request examples

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

async function createCardPayment(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;
  } catch (error) {
    console.error('Ошибка:', error.message);
  }
}

// Пример данных запроса
const mockApiKey = process.env.ONEPAYMENT_API_KEY;
const mockData = {
  partner_id: 1234,
  payment_type: 'card',
  project_id: 5678,
  account: '4111111111111111',
  card_holder: 'TEST',
  year: '22',
  month: '01',
  cvc: '111',
  amount: '50.00',
  user_data: 'order_777',
  shop_url: 'https://test.com',
  description: 'test_payment',
};

createCardPayment(mockApiKey, mockData).then(console.log);

API response

Successful response (200):

{
  "order_id": "8p3brmb19gfg0sg8gcwhws8kgc748s87",
  "status": 2,
  "status_description": "PENDING",
  "status_code": 0,
  "redirect_url": "https://testsite.com"
}
FieldDescription
order_idPayment ID in the 1Payment system; use for status requests.
statusNumeric status code (2 — pending).
status_descriptionText status description (PENDING, etc.).
status_codeDecline error code (see decline codes).
redirect_urlURL to redirect the payer for 3-D Secure (may be absent).

If the response contains redirect_url, redirect the payer to that address to complete payment.

Request error (400):

{
  "error_code": 2
}

Testing

You can use the following data to test card payments:

ResultCard numberCARDHOLDEREXPCVC
Successful payment4111111111111111TEST01/01123
Failed payment4111111111111112TEST01/01123

Status notifications (callbacks)

After the status changes, a POST notification in JSON format is sent to your notify_url.

ParameterTypeReq.Description
payment_typeStringYesPayment type (card).
order_idStringYesPayment ID in the 1Payment system.
project_idIntegerYesYour project ID.
statusIntegerYesStatus: 2 (pending), 3 (success), 4 (declined).
status_descriptionStringYesPENDING, SUCCESS, or FAILURE.
redirect_urlStringNoRedirect URL if payment completion is required.
init_timeStringYesPayment creation time.
status_timeStringYesTime the final status was received.
merchant_priceNumberYesAmount charged to the payer.
init_priceNumberNoAmount at initialization.
user_priceNumberYesPartner payout amount.
currencyStringYesPayment currency (ISO 4217).
accountStringYesMasked card number.
user_dataStringYesTransaction ID passed at creation.
signStringYesCallback signature.
tokenStringNoSaved card identifier after successful payment (if enabled).
testIntegerNo1 for test payments.
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 all parameters in alphabetical order joined with & + API_KEY (without the init_payment prefix). For details, see API request format.

Was this article helpful?