DEV Community

Giuseppe Falcetta
Giuseppe Falcetta

Posted on AI-assisted

Making Stripe subscription Checkout checks repeatable

When a subscription checkout changes, there are several things to check: did the app create a subscription-mode Checkout Session, did it use the expected recurring Price, did Stripe create the subscription, and did the app process the related events?

Those checks are related, but they are not the same test. Treating them as one all-or-nothing browser script can make failures hard to interpret—especially when the hosted payment page itself is difficult to automate.

I’m building SubTest, an open-source local CLI for repeatable Stripe subscription checks.

1. Check the Checkout Session contract

SubTest follows browser steps that you configure for your application, captures the test Checkout Session your app creates, then checks that Session through Stripe’s API. The default check verifies the subscription mode and expected recurring Price without filling in the payment form or claiming a payment succeeded.

This is useful when you want a repeatable check that your app is creating the intended Stripe Session after a code or configuration change.

2. Exercise lifecycle and webhook evidence separately

A Test Clock scenario creates its own test customer and subscription directly through Stripe, advances simulated time, and checks Stripe-side subscription and invoice state. If you configure a local evidence endpoint, SubTest can also check whether your app reports processing the expected Stripe event IDs.

That endpoint is application-provided evidence. SubTest does not inspect an arbitrary app database or infer that the app updated its internal business state correctly.

3. Treat the hosted browser attempt as optional

The --browser-smoke option attempts the hosted Checkout UI with configured test payment details. Browser automation can be blocked or the UI can change, so this is a best-effort check. If it blocks, SubTest keeps the Session checks and reports a partial result with the browser evidence it observed; it cannot always identify the exact cause.

The tool runs locally, stores history in SQLite, and includes a local dashboard. It accepts Stripe test-mode keys only. To try it, you’ll need Node.js 22.13+, pnpm, your own Stripe test account, a recurring test Price, and an app checkout flow to configure.

The repository and quick start are at github.com/pepito1198/subtest. If you try it, I’d value feedback on where setup is unclear and which subscription checks you need most.

Top comments (1)

Collapse
 
challan116ux profile image
challan116-ux •

Separating the session contract check from the lifecycle check is the right split — when one all-or-nothing browser test fails, you learn nothing about which layer actually broke. The point I'd stress most is the Test Clock approach: deterministic time is what makes subscription tests repeatable at all, since real clocks turn every retry and renewal into a flake. We test our own partner webhooks the same way, checking the contract first and the event evidence second, and it has cut our false failures dramatically.