Skip to content
RecipesDoc

Stripe Test Mode Payments and Feature Flags (LaunchDarkly or Similar)

Runs pay with Stripe test cards and know which flags are on in each environment, from notes you keep in the wiki.

For teams whose test environment takes payments in Stripe test mode and turns features on and off with flags.

Your setup

  • A staging app with checkout through Stripe in test mode.
  • Feature flags in LaunchDarkly, Unleash, Flagsmith or similar, set differently per environment.
  • You want checkout tested (success, decline, 3D Secure) and the flagged features tested where they are on.

Say this to Certyn

Staging uses Stripe test mode, and the new checkout is behind a LaunchDarkly flag that is on in staging only. Set things up so your runs can test payments.

What Certyn does

  1. Writes the Stripe test cards to the wiki's testing rules. They are public, not secrets:
    • 4242 4242 4242 4242: payment succeeds.
    • 4000 0000 0000 0002: card is declined.
    • 4000 0025 0000 3155: asks for 3D Secure.
    • Any future date, any three-digit CVC.
  2. Writes the flag state per environment to the wiki, for example: new-checkout: on in staging, off in production. Every run reads these rules when it starts.
  3. If runs should also check the payment in Stripe, opens a secret form for STRIPE_SECRET_KEY (service stripe, the test secret key). A run can then look up the payment with Stripe's API from its shell.
  4. Proposes test cases tagged, for example, checkout: pay with the success card, the decline card (expect a clear error, no order), and the 3D Secure card.

What you get

  • Checkout tests that use the right card for each case.
  • Runs that test the new checkout where its flag is on, and do not report the old checkout as a bug where it is off.
  • A Certyn issue with evidence for each real payment bug.

Limits

  • Certyn has no feature-flag integration. It does not read or change flags in LaunchDarkly or any other tool. It trusts the wiki, so update the wiki when a flag changes.
  • To let a run switch a flag, save the flag tool's API token with the secret form and ask for it in the goal. The run calls that tool's API from its shell. Do this only on test environments.
  • Save only Stripe test keys. Never run payment tests on production: it is in live mode, where test cards fail and real cards are charged. For production, use Read-Only Smoke Check on Production.
  • Certyn does not set up Stripe. Your test mode webhooks must already reach staging.
  • The wiki is one for the project, not one per environment. Name the environment on each flag line.