Fulfillment guide
1
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.
- customer.subscription.updated — For subscription sessions, when status changes (e.g., incomplete → active).
- checkout_session.completed — Sent after a checkout session has fully completed.
2
Create an event handler
Set up an HTTP endpoint to receive and log incoming events. For local testing, use ngrok or webhook.site.
3
Create a webhook endpoint
Register your handler’s public URL in Flex. Here we listen for
checkout.session.completed
:4
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
5
Verify events came from Flex
Confirm the signature on incoming requests before processing. See Verifying webhooks.
6
Fulfill order
Handle
checkout.session.completed
to:- Save the order to your database
- Send a receipt email
- Update inventory via the Line Items API:
7
Go live in production
Once deployed, register your production webhook URL in Flex.