Stripe Checkout with webhook sequence
A sequence diagram for Stripe Checkout: create a session, redirect the user, handle the async webhook with idempotency, and update internal state on payment_intent.succeeded.
Sequence diagram previewStripe Checkout with webhook sequence
Recreate this in Raltey
Copy this prompt
Paste this into Raltey's AI agent to generate the same diagram, then tweak it on the canvas.
Prompt
Create a sequence diagram for Stripe Checkout with the async webhook. Actors: User, App server, Stripe, Database. Show: POST /checkout to app, app creates a Stripe Checkout Session, user redirected to Stripe, pays, redirect to success_url. Then the async path: Stripe POSTs /webhook with the event, app checks the database for idempotency, marks the order paid, returns 200 OK to Stripe.
Context
- - Checkout Sessions (hosted).
- - Webhook is the source of truth, not the success redirect.
- - Idempotent handler keyed on event id.
Patterns
- - Webhook is the source of truth, not the redirect.
- - Idempotency keyed on Stripe event id.
- - Acknowledge the webhook within 5 seconds.
Diagram structure
Nodes and connections
User
App server
Stripe
Database
Connections
UserApp serverPOST /checkout
App serverStripeCreate Checkout Session
StripeApp serverSession URL
App serverUserRedirect to Stripe
UserStripePay
StripeUserRedirect success_url
StripeApp serverPOST /webhook (event)
App serverDatabaseAlready processed?
DatabaseApp serverNo
App serverDatabaseMark order paid
App serverStripe200 OK
Notes from the field
- Verify the webhook signature using your endpoint secret.
- Do not rely on success_url alone - users may close the tab before redirect.
- Record the raw Stripe event for debugging and retry.
Frequently asked
What happens if the webhook arrives twice?
The idempotency check rejects the second one based on the stored Stripe event id. Stripe explicitly says to handle this.
Should I show success based on the redirect?
Use the redirect to show a "thanks" page, but treat the order as paid only after the webhook confirms it.
More templates
FlowchartSaaS onboarding email flowFlowchartCustomer support runbook flowFlowchartPayment webhook retry and error flowFlowchartGitHub PR review and merge flowFlowchartLogin with magic link flowArchitectureThree-tier SaaS architecture on AWSArchitectureMicroservices architecture on KubernetesArchitectureReal-time data pipeline on GCP
Open this template in Raltey
Edit it on the canvas, ask the AI agent to extend it, then share or export.
Start for free