Founder deal: 75% off the lifetime licence. Unlimited sites, one payment, every update.See the founder plan
Home / Blog / Declines and diagnostics

Test card numbers and the sandbox scenarios every launch needs

Most teams test three cards and go live. Here are the fifteen scenarios that matter, including the timeout test that produces double charges.

Every gateway publishes a list of test card numbers, and most teams use three of them: one that approves, one that declines, one that is expired. Then they go live and discover the twelve scenarios nobody rehearsed.

The two environments

A sandbox is a simulator. It returns scripted responses, it never moves money, and it will happily approve things your live account is not enabled for. That last point matters: a sandbox pass does not prove your merchant account supports the transaction type.

Live testing with small real amounts, refunded afterwards, is the only way to confirm currencies, transaction types and funding actually work. Budget for a handful of one dollar orders on launch day.

How test cards trigger responses

Gateways use two conventions. Some assign a card number to an outcome. Others use the amount: a cents value maps to a decline reason, so 1.05 might return insufficient funds and 1.51 a fraud block. Learn which convention yours uses, because the amount based one lets you test dozens of paths with a single card.

The scenarios worth scripting

  1. Approved sale, then a full refund, then a partial refund.
  2. Authorisation only, then capture for a lower amount, then a void.
  3. Authorisation that expires without capture.
  4. Soft decline, insufficient funds. Check the message the shopper sees.
  5. Hard decline, stolen card. Confirm your system does not retry.
  6. AVS mismatch with a correct CVV, and the reverse.
  7. 3D Secure challenge completed, and 3D Secure abandoned.
  8. Duplicate submission: double click the pay button.
  9. Network timeout mid authorisation. Kill the connection and see whether the order duplicates.
  10. Saved card charged later with no CVV present.
  11. Subscription renewal flagged as merchant initiated.
  12. ACH debit followed by a return code two days later.
  13. Refund larger than the original, which must fail cleanly.
  14. Zero amount authorisation used to validate a card.
  15. Currency with no decimal places, if you sell in one.

The timeout test is the one people skip

It is also the one that produces the worst production incident: the gateway approved, your server never heard back, the customer clicked again, and you charged twice. Simulate it by blocking the outbound call after the request leaves. Correct behaviour is an idempotency key on the request and a reconciliation step that checks the gateway before creating a second charge.

What to check after each test

  • The order status in WooCommerce, not just the message on screen.
  • The order note carrying the gateway response, AVS and CVV letters.
  • The email that went out, including the amount and the descriptor.
  • Stock levels, which should not move on a failed payment.
  • The gateway transaction record, matched by order number.

Before you switch to live

Rotate the sandbox keys out rather than leaving them in a config file. Confirm the live account is enabled for every transaction type you tested. Place one real order, refund it, and check the money leaves and returns. Then watch the first fifty live orders closely, because the real world always finds a path the script did not. The testing and sandbox guide lists the specifics.

Related guides: What Is the NMI Payment Gateway? A Plain Guide for WooCommerce Owners | NMI Payment Gateway API Explained: Payment API, Collect.js and Query API | NMI Support: Who to Contact for Gateway, Processor and Plugin Problems

NMI for WooCommerce

Test the whole flow in sandbox.

Sandbox mode is in the free version, with the same order notes and gateway responses as live.

Testing and sandboxSee pricing

Free on WordPress.org. Pro from $49 per year, lifetime from $149.