Skip to content

Testing

Drive every outcome on demand, before a real payer ever does.

Every failure a real payer can produce, you can produce on purpose: insufficient funds, a refused PIN, an operator timeout, a declined card, a failed refund. Sandbox is not a mock of the API, it is the same API writing to a different database, so the code you test is the code you ship.

The three tools

ToolUse it to
Sandbox keysRun your whole integration against test money
Test numbers and cardsChoose which outcome the sandbox produces
The CLIReceive live events on localhost and trigger them on demand

What a complete test run covers

Most integrations test the happy path and ship. These eight are what breaks afterwards, and each one is a single input away. Your ticks are kept in this browser, so a run can span several days.

Sandbox test run

0/8
  • Force it with +237670000002, with no human looking at it.

    View guide →
  • Force it with +237670000001. It is not the same failure as a refusal.

  • Force it with +237670000003, the timeout. The order must not stay open forever.

  • +237670000009 pays, then refuses the refund. Your ledger must wait for the money to leave.

  • Change one character of the secret and confirm your endpoint answers 400.

    View guide →
  • Replay a delivery and assert one order, one email, one credit.

    View guide →
  • One payment.succeeded trigger delivers five events. A handler that knows one drops four.

    View guide →
  • A slower answer counts as a failure. The delivery gets five attempts over sixteen minutes.

    View guide →

The signature test is the one almost nobody writes, and the only one that protects the money.

The loop that makes this quick

Two terminals, no deploy, no phone
# 1
wajub listen --forward-to localhost:3000/webhooks/wajub

# 2
wajub trigger payment.succeeded
wajub trigger payment.failed
wajub trigger refund.succeeded

Each trigger drives the sandbox API end to end, so what reaches your handler is a real event chain rather than a fixture.

Everything above is provable in sandbox. What is not provable there, live keys, restricted scopes, alerting, belongs to the go live checklist, which carries its own list.

What did you think of this content?