Card test mode is a payment sandbox

Card test mode is a sandbox in a payment processor. It accepts test card numbers. It returns simulated approval and decline responses. It does not connect to card networks. It does not move real money. Processors use it to test checkout code, API calls, and webhooks before launch.

How test mode works

Test mode runs on separate API keys. A test key starts with a prefix the processor assigns. The processor routes requests to a test environment. That environment checks request format and returns a coded response. Stripe publishes test card number 4242 4242 4242 4242. The number passes a Luhn check and returns a simulated approval in test mode. Test mode also returns decline codes for expired cards, insufficient funds, and lost cards.

Test mode does not check a real issuer. It does not check a real balance. It does not prove a live card will approve. It tests code paths and error handling.

Setup steps

  1. Open the processor dashboard.
  2. Switch the account to test mode.
  3. Copy the test API keys.
  4. Set the test key in the development environment.
  5. Use published test card numbers.
  6. Send test charges and review response codes.
  7. Check webhook delivery and signature checks.
  8. Switch to live keys after tests pass.

What test mode does not cover

Test mode does not cover issuer fraud rules. It does not cover real 3D Secure challenges unless the processor simulates them. It does not cover settlement, refunds to a real bank, or chargeback cycles. A test approval is not a live approval. Use a small live charge to check the full path.

Common mistakes

  • Using a live key in test code.
  • Using real card numbers in test mode.
  • Hardcoding keys in source files.
  • Skipping webhook signature checks.
  • Testing one card brand and one response code.

Keep test keys out of production. Keep live keys out of test code. Log request IDs and response codes. Match each test case to one expected result.