Balance request
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
- Request — your server calls
get_balancewithpartner_idandsignsignature. - Verification — the API verifies the signature and partner permissions.
- Response — JSON with a
project_balancelist per project.
Technical details
| Endpoint | https://api.1payment.com/get_balance |
| Methods | GET, POST |
| Response format | JSON |
Request parameters
Required
| Parameter | Type | Description |
|---|---|---|
partner_id | Integer | Your unique ID in the 1Payment system. |
sign | String | Request 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_keySignature 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=1234String for MD5:
get_balancepartner_id=1234Expected signature:
f47621c39e05656d10454d4e8cf9a7afSignature 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
}
]
}| Field | Description |
|---|---|
project_balance | Array of balances per partner project. |
project_id | Project ID. |
currency | Currency (ISO 4217). |
payout_balance | Funds available for payouts at the moment. |
expected_balance | Expected balance after all funds are credited (if provided). |
hold | Held amount. |
Request error (400):
{
"error_code": 2
}error_code meanings — in Error codes (API). Insufficient payout funds in other methods may return code 9.