Overview
We use Stripe as our payment processor and checkout system.
Checkout Lifecycle
See: How Checkout Works.
Stripe Checkout Lifecycle
Development Sandbox
We use Stripe's sandbox feature to test features in development. (This is the newer version of the "test mode" feature)
There is a shared development sandbox at https://dashboard.stripe.com/sandboxes
Testing Webhooks
When a user completes a payment, Stripe sends a POST
event with a secret that we verify and relevant metadata to /billing/stripe/webhook
.
To test receiving webhook events on your local developer instance, set up the Stripe CLI with the development sandbox, and run
stripe listen --forward-to https://localhost:3000/billing/stripe/webhook --skip-verify
You can then either trigger Stripe events in the dev instance UI, or manually with the Stripe CLI:
stripe trigger checkout.session.completed --add checkout_session:metadata.clerk_user_id=user_2kAfEUn6gkfHHgpDCREdjT3foKH
You may have to update STRIPE_ENDPOINT_SECRET
in your local .env
file with the value provided by the Stripe CLI.