Change a vendor's balance
Цей контент ще не доступний вашою мовою.
These methods change the balance of a vendor and record the change as a payment in the Payments History of the root customer. They are the API side of the balance actions on the vendor in the panel: E-Payment (Add Funds), Manual Credit and Manual Charge (Debit).
The methods support trusted mode with i_customer, which is 1, the root customer.
| Method | Balance | Recorded as | Use it for |
|---|---|---|---|
vendorAddFunds |
Goes up by amount |
Payment with a positive amount, method Add Funds | Money you paid to the vendor, for example to prepay traffic |
vendorCredit |
Goes up by amount |
Payment with a positive amount, method Credit | A credit note from the vendor, no money paid |
vendorDebit |
Goes down by amount |
Payment with a negative amount, method Debit | A manual charge |
vendorAddFunds and vendorCredit change the balance in exactly the same way. They differ only in how the payment is labelled in the history.
Common parameters
Section titled “Common parameters”All three methods take the same parameters.
| Name | Type | Required | Description |
|---|---|---|---|
i_vendor |
int | yes | ID of the vendor |
amount |
double | yes | Amount, as a positive number. vendorDebit 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 |
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 vendor’s currency, amount is converted with the exchange rates of the root customer, and the payment is recorded in the vendor’s currency. The currency must have an exchange rate there, otherwise the call fails. System vendors cannot be paid.
vendorAddFunds
Section titled “vendorAddFunds”Records a payment you made to the vendor and adds it to the vendor’s balance.
Parameters
Section titled “Parameters”The common parameters.
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
Example
Section titled “Example”call("vendorAddFunds", { "i_vendor": 5, "amount": 1000.0, "currency": "USD", "payment_notes": "Prepayment, wire 2026-01-15",}){"result": "OK"}vendorCredit
Section titled “vendorCredit”Credits the vendor’s balance without a payment.
Parameters
Section titled “Parameters”The common parameters.
Returns
Section titled “Returns”| Name | Type | Description |
|---|---|---|
result |
string | OK |
Example
Section titled “Example”call("vendorCredit", { "i_vendor": 5, "amount": 40.0, "currency": "USD", "payment_notes": "Credit note CN-118, disputed calls",}){"result": "OK"}vendorDebit
Section titled “vendorDebit”Charges the vendor’s balance: it 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("vendorDebit", { "i_vendor": 5, "amount": 15.0, "currency": "USD", "payment_notes": "Port fee",}){"result": "OK"}Related
Section titled “Related”- Vendors: the balance actions of a vendor
- Payments: Payments History of the root customer
- Manage vendors
- Change an account’s balance