Balance
Check what the account holds before you pay out, and use it to reconcile amounts that never appear in a webhook.
How it fits together
- 1
Read the balance
Call GET /v1/balance/query. data.result holds one entry per currency, each with available, freeze and total.
- 2
Check available before a withdrawal
Compare the amount with available first. The platform reserves the amount as soon as the withdrawal is created.
- 3
Reconcile what webhooks leave out
Transfers the central account makes on P2P, and refunds, are not in any webhook payload. Reconcile them from balance history.
In this section
Before you start
Amounts come back as strings
available, freeze and total are strings such as "0". Parse them with a decimal type rather than a float so the fractions stay exact.
Post from the per-currency figures
total_usd_equity and total_btc_equity express the whole account in another currency, so their value moves with exchange rates. Post to your ledger from the amount of each currency instead.
THB_P2P credit
On P2P, fees and central-account transfers come out of THB_P2P credit. When the credit runs out, you cannot create new transactions.
How THB_P2P credit is debited