delivery_fee from your merchant wallet when each order is created. If your balance drops below the fee for a delivery, the create-order call fails with 402 Insufficient Funds. This guide shows you how to check balance, respond to that error, and build a proactive top-up workflow.
Check your wallet balance
CallGET /api/v1/external/wallet to get your current balance:
Handling a 402 Insufficient Funds error
When create-order returns 402, the response tells you exactly what you have and what you need:
- Don’t fail silently. The customer’s payment succeeded — their order must not simply disappear.
- Flag the order in your system as
dispatch_pending_funds. - Alert your operations team with the shortfall:
required - balance = 5850 MWK needed. - Tell the customer that their order is confirmed and the delivery will be dispatched shortly.
- After topping up, retry
create-orderwith the sameIdempotency-Keyto dispatch.
The full 402 recovery flow
Retrying after a top-up
Once your ops team tops up the wallet, retry the original create-order call using the exact sameIdempotency-Key you used on the first attempt. Yonne will see the key, check that the original order was not yet created, and process it now.
Node.js
Proactive balance monitoring
To avoid402 errors reaching customers at all, set up a daily or hourly balance check and alert your team when balance drops below a safe threshold:
