Change a customer's balance
Цей контент ще не доступний вашою мовою.
These methods change the balance of one of your sub-customers, for example a reseller, and record the change as a payment in its Payment History. They are the API side of the balance actions on the customer in the panel: E-Payment (Add Funds), Manual Credit and Manual Charge (Debit).
The methods support trusted mode with i_wholesaler, the ID of the customer that owns the one you change.
| Method | Balance | Recorded as | Use it for |
|---|---|---|---|
customerAddFunds |
Goes up by amount |
Payment with a positive amount, method Add Funds | Money you received from the customer |
customerCredit |
Goes up by amount |
Payment with a positive amount, method Credit | A refund or a goodwill credit, no money received |
customerDebit |
Goes down by amount |
Payment with a negative amount, method Debit | A manual charge |
customerAddFunds and customerCredit change the balance in exactly the same way. They differ only in how the payment is labelled in the history and the reports.
Common parameters
Section titled “Common parameters”All three methods take the same parameters.
| Name | Type | Required | Description |
|---|---|---|---|
i_customer |
int | yes | ID of the sub-customer |
amount |
double | yes | Amount, as a positive number. customerDebit subtracts it, the other methods add it |
currency |
string | yes | ISO 4217 code of the currency of amount, for example USD |
payment_notes |
string | no | Notes stored with the payment. This is the only place to explain a manual change later |
payment_time |
string | no | Time of the payment, UTC, in the format %H:%M:%S.000 GMT %a %b %d %Y, for example 09:57:29.000 GMT Wed Nov 18 2009. Default: now |
When currency is not the sub-customer’s currency, amount is converted with the exchange rates of its owner, and the payment is recorded in the sub-customer’s currency. The currency must have an exchange rate there, otherwise the call fails.
customerAddFunds
Section titled “customerAddFunds”Adds a received payment to the sub-customer’s balance.
Parameters
Section titled “Parameters”The common parameters.
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
Example
Section titled “Example”call("customerAddFunds", { "i_customer": 17, "amount": 500.0, "currency": "EUR", "payment_notes": "Invoice 2026-001 paid",}){"result": "OK"}customerCredit
Section titled “customerCredit”Credits the sub-customer’s balance without a received payment.
Parameters
Section titled “Parameters”The common parameters.
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
Example
Section titled “Example”call("customerCredit", { "i_customer": 17, "amount": 12.0, "currency": "EUR", "payment_notes": "Credit for outage on 2026-01-14",}){"result": "OK"}customerDebit
Section titled “customerDebit”Charges the sub-customer: the balance goes down by amount.
Parameters
Section titled “Parameters”The common parameters. Pass amount as a positive number.
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
Example
Section titled “Example”call("customerDebit", { "i_customer": 17, "amount": 30.0, "currency": "EUR", "payment_notes": "Monthly platform fee",}){"result": "OK"}Related
Section titled “Related”- Customers: the balance actions of a customer
- Balance and credit limit
- Payments: the payment history
- Get payment details
- Change an account’s balance
- Get customer information: the current
balance