English
Collect and Recover Funds
The merchant BUSINESS account collects completed customer payments as internal credits. Keep three views separate:
- Payment transaction status proves whether an individual order completed.
- The merchant balance shows funds currently available or reserved.
- The ledger records finalized balance movements for reconciliation.
Confirm collected payments
Query the merchant ledger for incoming internal transfers.
bash
wallet_request GET "/accounts/$PAYMENT_ACCOUNT_ID/ledger?asset_type_id=$ASSET_TYPE_ID&transaction_type=INTERNAL_IN&after_id=0&limit=100" | jqEach customer payment creates INTERNAL_OUT / DEBIT on the customer account and INTERNAL_IN / CREDIT on the merchant account. Both entries share the payment withdrawal_id as ref_id.
GET /withdrawals?account_id=$PAYMENT_ACCOUNT_ID lists transactions sent by the merchant account. It does not list payments received from customers; use the INTERNAL_IN ledger query for receipts.
Monitor available and reserved funds
bash
wallet_request GET "/accounts/$PAYMENT_ACCOUNT_ID/balances/$ASSET_TYPE_ID" | jqBefore settlement, verify the amount is in available_amount_raw. After creating an external withdrawal, the amount and fee move into pending_withdraw_amount_raw until processing reaches a final state.
Do not treat this reservation as a completed payout.
Recover from a failed settlement
If creation timed out, recover the existing request by client_request_id before considering another submission.
bash
wallet_request GET "/withdrawals/client-request/$SETTLEMENT_REQUEST_ID" | jqWhen an external withdrawal reaches FAILED, REJECTED, or CANCELLED, verify the final detail and then query the balance again.
bash
wallet_request GET "/withdrawals/$WITHDRAWAL_ID" | jq
wallet_request GET "/accounts/$PAYMENT_ACCOUNT_ID/balances/$ASSET_TYPE_ID" | jqOOLIN returns the reserved withdrawal amount and fee to the available balance after failed or rejected withdrawal processing. Your backend should not credit funds independently; verify the authoritative balance and create a new request only after the original has a final state.