Skip to content

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.

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.

Adds a received payment to the sub-customer’s balance.

The common parameters.

Name Type Description
result string OK
request
call("customerAddFunds", {
"i_customer": 17,
"amount": 500.0,
"currency": "EUR",
"payment_notes": "Invoice 2026-001 paid",
})
response
{"result": "OK"}

Credits the sub-customer’s balance without a received payment.

The common parameters.

Name Type Description
result string OK
request
call("customerCredit", {
"i_customer": 17,
"amount": 12.0,
"currency": "EUR",
"payment_notes": "Credit for outage on 2026-01-14",
})
response
{"result": "OK"}

Charges the sub-customer: the balance goes down by amount.

The common parameters. Pass amount as a positive number.

Name Type Description
result string OK
request
call("customerDebit", {
"i_customer": 17,
"amount": 30.0,
"currency": "EUR",
"payment_notes": "Monthly platform fee",
})
response
{"result": "OK"}