Skip to main content
Yonne deducts the 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

Call GET /api/v1/external/wallet to get your current balance:
Response:

Handling a 402 Insufficient Funds error

When create-order returns 402, the response tells you exactly what you have and what you need:
Your response should be:
  1. Don’t fail silently. The customer’s payment succeeded — their order must not simply disappear.
  2. Flag the order in your system as dispatch_pending_funds.
  3. Alert your operations team with the shortfall: required - balance = 5850 MWK needed.
  4. Tell the customer that their order is confirmed and the delivery will be dispatched shortly.
  5. After topping up, retry create-order with the same Idempotency-Key to 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 same Idempotency-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
Do not generate a new key — that would create a duplicate order.

Proactive balance monitoring

To avoid 402 errors reaching customers at all, set up a daily or hourly balance check and alert your team when balance drops below a safe threshold:
Run this on a schedule (e.g. every hour via cron) so your ops team knows to top up before orders start failing.

Top-up process

Wallet top-ups are done through the Yonne merchant dashboard. The API does not expose a direct top-up endpoint — this is intentional to keep financial transactions in a controlled, audited channel. After topping up in the dashboard, confirm the new balance before retrying pending dispatches: