Engineering·

How to Test Checkout Payments, and What Test Cards Won't Catch

Stripe, Adyen, Shopify and Klarna test cards and sample data, the payment scenarios worth testing, where to run them, and the checkout bugs a successful test payment won't catch.

QA.tech

A brass balance scale weighing a blank frosted payment card against a glass counterweight, on a jade and pine green background.

To test checkout payments, run the full checkout against your payment provider's sandbox with its test cards: a successful payment, a decline, insufficient funds and a 3D Secure challenge at minimum. Then check what the gateway can't: that the amount it was asked to charge was right. A test card only proves the gateway call works; the price, discount, shipping and currency need their own checks.

Stripe, Adyen and Shopify test card numbers

Test cards only work in test mode or a sandbox. They're safe to publish, and every provider does.

Stripe

From Stripe's testing docs: use any future expiry date (Stripe suggests 12/34) and any three-digit CVC (four for American Express).

ScenarioCard number
Successful Visa payment4242 4242 4242 4242
Generic decline4000 0000 0000 0002
Insufficient funds4000 0000 0000 9995
3D Secure, always authenticate4000 0027 6000 3184
3D Secure required (Ireland-issued)4000 0000 0000 3220

Stripe is explicit that you shouldn't test in live mode with real card details: its services agreement prohibits it.

Adyen

From Adyen's test card numbers: expiry 03/2030, CVC 737, and the cards "only work with Adyen's test platform".

ScenarioCard number
Visa4111 1111 1111 1111
Mastercard5555 5555 5555 4444
3D Secure 2, Mastercard5454 5454 5454 5454
3D Secure 2, Visa4917 6100 0000 0000

Adyen lists separate cards for local schemes such as Cartes Bancaires, Bancontact and Dankort, which matters if you sell in those markets.

Shopify's test payment gateway

Shopify's test gateway (search "Bogus" in your payment settings to find it) takes "1" as the card number for an approved transaction, "2" for a decline and "3" for a gateway failure, with "Test payment gateway" as the name on the card. Shopify also notes that customers can't place live orders while your payment provider is in test mode, so this belongs in a development store or a quiet window, not a live one.

Klarna

Klarna doesn't use test cards. Its playground has sample customer data per country, with one set of details that's approved and another that's denied, and a one-time password of 123456. Test both: a denied buy-now-pay-later attempt is a normal path, and your checkout has to offer the shopper another way to pay.

The payment scenarios worth testing

The happy path usually passes, so spend the effort on these cases.

  • Decline, then retry with another card. Does the cart survive? Is the order created twice?
  • 3D Secure challenge passed, failed and abandoned. The abandoned one is where shoppers close the bank's pop-up and come back to a spinner.
  • Back button or refresh during a redirect to a hosted payment page or a bank.
  • Double-clicking "Pay".
  • A different currency from the store default, and a card issued in another country.
  • Each payment method you offer: cards, wallets, buy-now-pay-later, local methods. Each one has its own failure page.
  • Discount codes and gift cards that bring part of the total to zero, or all of it.
  • What happens after payment: the confirmation page, the confirmation email, the order in the back office, and a refund.

That last one is easy to leave out, and for some stores it carries a lot of the process. At a European online gifting retailer, the CTO told us "the other 50% is booking carriers" once the shopper has paid, so without a test payment "we cannot trigger the last 50% of the process."

What a successful test payment won't catch

In our Black Friday bug study, the agents never entered a card and still found money bugs before the payment page:

  • a 339 kr frame option that never reached the 309 kr price,
  • 0 kr shipping in the cart that became 29 kr at checkout,
  • a pillow line still charging for one after the quantity went to two,
  • a bundle discount that never reached the cart.

A test card would have paid every one of those without complaint, because the gateway charges whatever amount it's sent. So a payment test needs a second assertion that has nothing to do with the gateway: the amount sent for payment matches the product prices, quantities, discounts, shipping and tax the shopper saw on the way.

Where to run payment tests

Staging with the gateway in test mode is where the full flow belongs, including the order lifecycle after payment. It's also the environment most likely to drift from production: different keys, different webhook endpoints, a payment method that's switched on in one and not the other. A luxury fashion brand told us about a checkout plugin that worked in their test environment and broke in production, where they don't place real orders.

Production up to the payment step catches the drift. Run the real checkout with real prices, stop on the payment page, check it loaded with the right amount and methods, and leave. Nothing is charged and no order is created. Run it on a schedule while a campaign is live.

A small real order you refund is the only way to prove production payments end to end. It's worth doing after any change to payment settings or providers. Mark these orders so they don't land in your revenue reports.

Testing payments with an agent

Payment pages are awkward for scripts: they're usually iframes or a different domain, they change when the provider ships an update, and 3D Secure adds a pop-up with its own layout. An agent that reads the page the way a person does copes with that better than a fixed selector. It won't make a sandbox behave like production, and it needs the test to say clearly where to stop.

On test cards, Vilhelm von Ehrenheim, our co-founder and Chief AI Officer, told a retailer in November: "I know in Stripe, the agents already know those cards. Like the 42." In QA.tech, a hosted payment page on another domain is set up as its own application, and the stopping point is part of the test: a production check ends at "the payment page shows the right total", while the staging test pays with the sandbox card and goes on to check the confirmation email and the order.

Our ecommerce test cases cover the rest of checkout, and checkout flow testing shows the product side.

Frequently asked questions

What is the Stripe test card number? 4242 4242 4242 4242 simulates a successful Visa payment in a Stripe sandbox, with any future expiry date (Stripe suggests 12/34) and any three-digit CVC. 4000 0000 0000 0002 simulates a generic decline and 4000 0027 6000 3184 always asks for 3D Secure authentication.

What are Adyen's test card numbers? Adyen publishes test cards per card brand, for example 4111 1111 1111 1111 (Visa) and 5555 5555 5555 4444 (Mastercard), both with expiry 03/2030 and CVC 737. They only work on Adyen's test platform.

Can you use test cards on a live store? No. Test cards only work with test API keys or a gateway in test mode. On Shopify, customers can't place live orders while your payment provider is in test mode, so don't switch a live store into test mode to run a check.

How do you test payments in production without placing orders? Run the checkout up to the payment step and stop there, which covers prices, discounts, shipping, tax and the payment page loading. For the payment itself, either test in a staging environment with the gateway in test mode or place a small real order and refund it.

What do test cards not catch? Anything decided before the gateway: wrong prices, discounts that don't apply, shipping that breaks a free-delivery promise, currency mix-ups. A successful test payment for the wrong amount is still a pass from the gateway's point of view.

Your team moves fast. Can your testing keep up?

Our QA agents test your product autonomously, so moving fast never means shipping broken. Start free or get a 30-minute demo.