Mercury Sandbox — Testing the Right Way
Sandbox documentation often focuses heavily on the “happy path.” Here is how to test failure scenarios and edge cases properly.
Simulating Failed Transactions / NSF (Non-Sufficient Funds)
In the Sandbox environment, you can trigger specific errors by using predefined “magic numbers” for the transfer amount or by using specific testing headers. Always verify that your system correctly processes the transaction.failed webhook.
Generating Test Recipients & Mock Webhooks
Test Recipient: Use a valid test routing number (e.g.,
111000025for sandbox) combined with a random account number.Mock Webhook: Use services like Webhook.site or Ngrok to catch webhooks locally. Register this URL in your Mercury Sandbox Dashboard.
Sandbox vs Production Behavior
Settlement Speed: In the Sandbox, ACH transactions often switch to
settledalmost immediately to facilitate testing. In Production, thesettledwebhook will take 2-3 days to arrive. Your architecture must be fully asynchronous.Compliance Checks: Production environments have strict Anti-Money Laundering (AML) filters. Transactions to certain entities might get stuck in a
pending_reviewstate. Ensure your system gracefully handles this intermediate state.