An NMI test card declined in live mode is working as designed: test card numbers are not real cards, so a live merchant account and the card networks reject them. The reverse also holds. A real card in a sandbox account fails or is simulated, because the sandbox is a separate system with its own keys. Almost every case comes down to which of three test setups you are in and which keys the store is using.
The three ways NMI lets you test
- Sandbox account. A separate environment with its own keys and portals. Every transaction is simulated. Live cards are not charged, and live credentials do not work in it.
- Test mode on a real account. Enabled in the Merchant Portal under Settings, Test Mode. All valid cards approve and nothing is sent to the processor.
- A one-off test transaction. A live key plus
test_mode=enabledon a single request, used with a documented test card. Only that request is simulated, and it works on live accounts only, not on a sandbox.
NMI's docs list the current card numbers and expiry, and the docs have disagreed on the test expiry date between pages, so copy numbers from NMI's current testing page and use a future expiry rather than trusting an old forum post. Typical documented values are Visa 4111111111111111 and CVV 999.
Why a test card fails in live mode
- Test mode is off. Most common cause, and the correct result. A live account sends the number to the processor, which declines an invalid account. Read the code in response and response_code; the 2xx series are issuer declines, and a rejection by the gateway is a 300.
- Wrong environment keys. A sandbox key on a live gateway, or the reverse, fails authentication before a card is even looked at.
- One-off test without the flag. If you want a single simulated charge on a live account you must send the test flag with that request.
Never use a test card number on a live account to try to see whether checkout works. Run a small real transaction instead, as in the go-live checklist.
Why a live card fails in sandbox
- Sandbox simulates. Documented triggers include an amount under 1.00 forcing a decline, an invalid card number returning a fatal error, and specific AVS and CVV values to simulate matches. A real card is not charged either way.
- Live keys in a sandbox store, or sandbox keys in a live store. Authentication fails before payment.
- Test mode on a real account. Everything approves, and you are fooled into thinking live is working. It is not.
A diagnosis order that takes five minutes
- Check the plugin banner. If it says sandbox, you are testing in sandbox.
- Check which security key the plugin holds: sandbox key, or live key. Match it to the account you are logged into.
- Check whether the Merchant Portal has Test Mode enabled.
- Check the public tokenization key came from the same environment as the private key.
- Read the order note for the response code and gateway text before touching anything.
- Match the card to the setup using the table in NMI's testing docs, not a random test number.
The same five-minute check applies when a card that should work declines for real. When the card is real but the answer is a decline, go to where to look first when NMI says declined and the card-declined diagnosis order.
Test scenarios worth running
A launch needs more than one approval. Run a decline, an AVS mismatch, a CVV mismatch, a refund, a void and an authorization with a capture. The full list is in test card numbers and sandbox scenarios every launch needs. If you save cards, also test the customer-side flow in updating or deleting saved cards; saved cards are a Pro feature of NMI for WooCommerce. You can click through a checkout on the live demo without touching your own keys.
Keep the environments apart
Use sandbox keys on every staging and development site, live keys on production only, and a visible banner so nobody guesses. The plugin ships a sandbox mode with a visible banner and separate credentials in the free version. The rest of the setup is in testing and sandbox, and more developer guides are on the developer hub.
Running NMI on WooCommerce? Free covers the basics and Pro adds the paid features. Compare Free and Pro.
Related guides: What Does Declined Mean on a Credit Card? A Plain Guide for Shoppers and Stores | Refer to Card Issuer (Code 01, 02, NMI 240): What It Means | Decline Code 14: Invalid Card Number at NMI Checkout
Last reviewed November 2026.