Skip to content

The method returns project balances for the partner: funds available for payouts, expected credits, and held amounts. Use it to check limits before payouts.

HTTP request format is in API request format.

How it works

  1. Request — your server calls get_balance with partner_id and sign signature.
  2. Verification — the API verifies the signature and partner permissions.
  3. Response — JSON with a project_balance list per project.

Technical details

Endpointhttps://api.1payment.com/get_balance
MethodsGET, POST
Response formatJSON

Request parameters

Required

ParameterTypeDescription
partner_idIntegerYour unique ID in the 1Payment system.
signStringRequest signature (see "Signature" section).

Signature generation (sign)

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

Formula:

MD5(get_balance + <parameters_without_sign_in_alphabetical_order_joined_by_&> + <API_KEY>)

Example string before hashing:

get_balancepartner_id=1234secret_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: partner_id=1234
String for MD5: get_balancepartner_id=1234
Expected signature: f47621c39e05656d10454d4e8cf9a7af
Signature does not match

Request examples

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

async function getBalance(apiKey, partnerId) {
  const params = { partner_id: partnerId };

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

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

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

const apiKey = process.env.ONEPAYMENT_API_KEY;
getBalance(apiKey, 1234).then(console.log);

API response

Successful response (200):

{
  "project_balance": [
    {
      "project_id": 123,
      "currency": "RUB",
      "payout_balance": 100,
      "hold": 0
    },
    {
      "project_id": 456,
      "currency": "USD",
      "payout_balance": 200,
      "expected_balance": 400,
      "hold": 0
    }
  ]
}
FieldDescription
project_balanceArray of balances per partner project.
project_idProject ID.
currencyCurrency (ISO 4217).
payout_balanceFunds available for payouts at the moment.
expected_balanceExpected balance after all funds are credited (if provided).
holdHeld amount.

Request error (400):

{
  "error_code": 2
}

error_code meanings — in Error codes (API). Insufficient payout funds in other methods may return code 9.

Was this article helpful?