# Test Stripe checkout and plan upgrades in test mode

> Billing bugs cost money twice. A plain-language test goes through Stripe Checkout in test mode, comes back and checks the plan changed, plus declines and 3D Secure.

By Jason Nguyen, Founder, Testsy. Published 2026-11-21. https://testsy.dev/blog/test-stripe-checkout-and-plan-upgrades/

## The flow that pays for everything else

A broken upgrade button does not throw an error anyone sees. Revenue just stops. Billing bugs are also the hardest to notice from inside the team, because nobody on the team pays.

The failures people write about are rarely in the payment form itself. One team that added a real checkout to its end-to-end tests describes the journey they cared about: [free to paid, out to Stripe Checkout, back to the app, plan upgraded](https://www.stigg.io/blog-posts/you-integrated-with-stripe-but-are-you-confident-that-it-works). The weak points are the hand-offs: the redirect back, the webhook that should change the plan, and the screen that should show it. A course on SaaS billing lists more: cancellation that removes access immediately instead of at the end of the period, a discount code that works on the wrong plan, [tax charged twice on an upgrade](https://yrkan.com/course/module-05-web-testing/billing-subscription-testing/).

## Test mode, never live

Stripe's test mode runs the whole flow without moving money. Its [testing page](https://docs.stripe.com/testing) lists the cards:

- `4242 4242 4242 4242`, any future expiry, any three-digit CVC: succeeds.
- `4000 0000 0000 0002`: a generic decline.
- `4000 0000 0000 3220`: requires 3D Secure authentication.

Point the test at a staging site that uses your test keys. A checkout test against a live store places a real order.

## The upgrade test

```text
Sign up with this run's email address and confirm it from the email.
Open Billing and check the plan reads "Free".
Choose "Upgrade to Pro". On the Stripe checkout page, pay with the
card 4242 4242 4242 4242, expiry 12/34 and CVC 123.
When you are back in the app, check Billing shows the plan "Pro"
and the next payment date.
Check the receipt email arrives and names the Pro plan.
```

The test creates its own account with the run's [mailbox](https://testsy.dev/docs/mailbox-phone-endpoints/), so each run starts from a free plan and nothing is left over from the last one. These card numbers are Stripe's public test values, not secrets.

## The cases that cost money

```text
Upgrade with the card 4000 0000 0000 0002 and check the app says the
payment was declined and the plan still reads "Free".
```

```text
Upgrade with the card 4000 0000 0000 3220, complete the authentication
step, and check the plan reads "Pro".
```

```text
Cancel the Pro plan and check Billing says access continues until
the end of the period, and Pro features are still available.
```

## What happens on the Stripe page

Stripe Checkout is a hosted page on another domain, and its card fields sit in iframes. The tester crosses domains and fills iframe fields the way a person does; on our practice site we have published runs of both, [across two sites](https://testsy.dev/blog/test-an-admin-site-and-a-public-site-as-two-people/) and [inside an iframe](https://testsy.dev/blog/test-iframes-shadow-dom-and-new-tabs/). We have not published a run against Stripe itself, so treat the first run as the proof: open its replay and check each step. If Stripe or your own bot protection challenges the browser, the run is reported as **Blocked**, which is not counted.

## What the test does not see

It checks what a customer sees: the plan on the screen, the receipt in the inbox. It does not inspect your webhook handler or your database. If the plan on the screen is right, the webhook did its job for that path; for retries, refunds and renewals over time, Stripe's own tools such as test clocks and the CLI are the place.

Save the upgrade test and run it after every deploy that touches billing, and nightly on a [schedule](https://testsy.dev/docs/schedules/).
