Agent Wranglers

Checkout and card data Required

Test every payment outcome with test cards

Keep one automated test for each payment outcome, using the provider's test cards and test clocks, and run them before every release that touches payments.

How to do it

Cover success, a decline, insufficient funds, a 3-D Secure challenge passed and failed, a delayed bank payment, a refund, a dispute and a failed renewal. Providers publish a test card for each, such as Stripe's 4242 4242 4242 4242 for success and 4000 0000 0000 0002 for a decline. Use a test clock to move a subscription through months in seconds. Forward test webhooks to your machine with the provider's command line tool. Keep payment fixtures apart, as in isolated test data.

Example

success                  4242 4242 4242 4242
generic decline          4000 0000 0000 0002
insufficient funds       4000 0000 0000 9995
3-D Secure always        4000 0027 6000 3184
fraud dispute            4000 0000 0000 0259
(Stripe test cards. Other providers publish their own lists.)

How to check

The suite has one named test for each outcome on the list. The CI log for the last payment change shows them all passing.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers payments playbook: https://agentwranglers.se/playbook/payments/checkout-and-card-data/payment-test-scenarios.