Skip to content

Simulate integration scenarios

There is no hosted event simulator. The sandbox sends real signed events if your Zwipe contact sets a webhook URL on your sandbox account and gives you its signing secret; otherwise sign a fixture event with your own test secret as shown in webhooks. Simulate HTTP responses locally using the offline demo or your existing API mocking tools. All examples below are test fixtures, not requests that should be sent to production.

Scenario Mock response sequence Expected application behavior
Normal issuance 202 pending → 200 pending → 200 issued Save the ID, show progress, then fetch balance.
Slow issuer Repeated pending beyond foreground deadline Preserve order; show processing and resume from a worker.
Lost POST response Transport error after simulated acceptance Retain original reference; reconcile without creating a replacement purchase.
Issuer rejected Card has status: failed and an error code Stop polling; review the cause before deliberate same-reference retry.
Unknown outcome, known issuer card in_doubt with issuer.card_id Try a balance read; on success read status again (only activation_pending turns issued).
Unknown outcome, no issuer card in_doubt, then balance 409 issuance_in_doubt Preserve the order and route to support/reconciliation.
Duplicate reference conflict 409 external_ref_conflict Do not invent a new key to bypass the conflict.
Token expires 401, then a new token Retry authentication once; stop on a second failure.
Missing scope 403 insufficient_scope Configuration issue; no endless token refresh.
Email code wrong 200 with verified: false Stay on code entry.
Wallet unavailable Null or known-expired link Balance screen still works; do not show an active wallet action.
Balance cached Same amount and as_of on repeated reads Preserve source timestamp; do not pretend a fresh issuer read occurred.
Another customer’s ID Your backend returns 404 No Zwipe call and no cross-customer data.
{
"card_id": "0192f7a4-5c2e-7d3b-9a1f-4e8b2c6d0a11",
"status": "in_doubt",
"error_code": "provider_timeout",
"balance_cents": 0,
"currency": "USD",
"external_ref": "offline-order-1001",
"created_at": "2026-10-15T12:00:00Z",
"venue": {"brand_id": 123, "restaurant_id": 456},
"issuer": {"card_id": null, "order_id": null, "wallet_url": null, "collect_url": null}
}

A balance read for that fixture should return HTTP 409 with:

{
"error": {
"code": "issuance_in_doubt",
"message": "This card has no confirmed issuer card yet. Contact Zwipe."
}
}

Do not infer an order’s state from elapsed time alone. Your tests should also verify that reopening a screen uses the saved order and that repeated load records pointing to the same issuer card do not double-count balance.