Fulfillment guide
Select webhook events
Choose the webhook events that are relevant to your checkout session.
- customer.created — When a customer record is created in Flex.
- payment_intent.created — As soon as the customer begins entering payment info.
- payment_intent.succeeded — After a successful payment (fires twice on split carts).
- customer.subscription.created — For subscription sessions, when a subscription is first created. Includes the subscription’s initial
status(e.g.,trialing,active, orincomplete). - customer.subscription.updated — Sent when an existing subscription changes (plan changes, payment failure, cancellation, etc.). Not sent at subscription creation, and not reliably sent on
trialing→activetransitions. Don’t depend on this event for detecting new subscriptions. - invoice.payment_succeeded — Sent when a subscription invoice is paid. The most reliable signal that a customer has paid — recommended for provisioning or extending membership / entitlements.
- checkout_session.completed — Sent after a checkout session has fully completed.
Recommended pattern for subscription fulfillmentTo avoid missing new subscriptions, follow this pattern:
- Provision membership / access on
customer.subscription.created, gated onstatus in (trialing, active). - Confirm or extend entitlement on
invoice.payment_succeeded(covers initial payment and renewals). - Sync state (status changes, plan changes, payment failures) on
customer.subscription.updated. - Revoke access on
customer.subscription.deleted.
customer.subscription.updated will cause you to silently miss new subscriptions, since Stripe does not fire .updated at sub creation.Create an event handler
Set up an HTTP endpoint to receive and log incoming events. For local testing, use ngrok or webhook.site.
Create a webhook endpoint
Register your handler’s public URL in Flex. Here we listen for
checkout.session.completed:Create a checkout session
Trigger a session to confirm your handler receives events:Then go through checkout:
- Enter contact info
- Fill any intake form
- Use card number
4242 4242 4242 4242, future expiry, any CVV, and postal code 90210 - Click Pay
Verify events came from Flex
Confirm the signature on incoming requests before processing. See Verifying webhooks.
Fulfill order
Handle
checkout.session.completed to:- Save the order to your database
- Send a receipt email
- Update inventory via the Line Items API:
Go live in production
Once deployed, register your production webhook URL in Flex.