How to use
Add theX-Sandbox-Scenario: <scenario> header to any cash-in or cash-out call. Without the header, the sandbox uses the success scenario by default.
Available scenarios
The canonical scenario values are:success, pending_long, rejected, returned, insufficient_funds, bad_clabe, timeout, service_unavailable.
Asynchronous result scenarios
Return201 PENDING synchronously; the final state arrives via webhook within seconds.
Synchronous error scenarios
Fail in the HTTP response itself — no webhook is sent.Cash-in restrictions:
insufficient_funds and bad_clabe do not apply to cash-in (there is no balance to debit, and the deposit CLABE is generated by the system). Sending either of them on a cash-in returns 400 with code SCENARIO_NOT_APPLICABLE.Example: success webhook
success scenario on a cash-out — the cash_out webhook receives:
Example: rejection webhook
insufficient_funds scenario — the cash_out webhook receives:
status: REJECTED, the receipt fields (reference, voucher) come back null — the SPEI network never confirmed the transaction. The full payload format is in the Webhooks Overview.
Restrictions
- The
X-Sandbox-Scenarioheader works exclusively on sandbox accounts. - Production accounts that send the header receive:
Best practices
- Test every scenario before going live — implement handling for all four statuses (
LIQUIDATED,PENDING,REJECTED,RETURNED). - Route by the
eventfield —*.settled,*.rejected, and*.returnedrequire different actions in your system. - Test with delay — use
pending_longto verify that your system handles slow settlement gracefully. - Idempotency — deduplicate by the
x-event-idheader; the same event may be redelivered.