Diagram Source — edit it live in the browser
title Payment Processing Flow

actor Customer
participant "Web App" as App
participant "Payment API" as Pay
participant "Stripe" as Stripe
participant Database

Customer->App: Click "Pay now"
App->Pay: POST /charge
Pay->Stripe: Create payment intent
Stripe-->Pay: Payment intent ID
Pay-->App: Redirect to Stripe
App-->Customer: Show payment form
Customer->Stripe: Enter card details
Stripe->Pay: Webhook: payment.succeeded
Pay->Database: UPDATE order status = paid
Pay-->App: 200 OK
App-->Customer: Show confirmation

What this diagram shows

This sequence diagram covers the modern Stripe Checkout / Payment Intents pattern used by most e-commerce and SaaS applications. It maps the complete payment lifecycle across five participants: customer, web app, internal payment API, Stripe, and database.

The key insight this diagram makes visible: card details never touch your server. The customer enters them directly on a Stripe-hosted form. Your app only learns the payment succeeded when Stripe sends a webhook — which means your order-fulfilment logic lives inside a webhook handler, not the checkout response.

Step-by-step flow breakdown

1
Customer clicks PayThe checkout button triggers a request to your backend to initiate the payment.
2
Backend creates a Payment IntentYour Payment API calls Stripe's POST /v1/payment_intents with the amount, currency, and metadata. Stripe returns a client_secret.
3
Customer sees Stripe's payment formThe browser is redirected to Stripe Checkout (or Stripe Elements is initialised with the client secret), displaying a PCI-compliant card input.
4
Customer enters card detailsCard data goes directly to Stripe — it never passes through your servers, so you avoid PCI DSS scope for cardholder data.
5
Stripe fires a webhookOn payment success, Stripe POSTs a payment_intent.succeeded event to your webhook endpoint. This is the authoritative signal that money moved.
6
Order status updated in databaseYour webhook handler updates the order to paid, triggers fulfilment (send email, provision access, ship item), and returns a 200 to Stripe.
7
Customer sees confirmationThe app redirects the customer to a success page (polled or real-time via WebSocket), showing the order confirmation.

When to use a payment sequence diagram

Common variations

Subscription / recurring billing

Add a Stripe->Pay: Webhook: invoice.payment_succeeded step on a recurring schedule. Your handler renews the subscription in the database rather than marking an order paid.

Refund flow

Add a separate flow starting with Customer->App: Request refund, App->Stripe: POST /v1/refunds, and a charge.refunded webhook updating the order to refunded.

PayPal or other providers

Replace the Stripe participant with your payment provider. The webhook-confirmation pattern is the same across Stripe, Braintree, PayPal, and most modern PSPs.

Payment failure handling

Add an alt fragment: [success] running the happy path and [failure] showing payment_intent.payment_failed triggering a retry email.

Related sequence diagram examples

Frequently asked questions

How does a Stripe payment flow work in sequence?

Your server creates a payment intent → customer enters card details on Stripe's form → Stripe charges the card → Stripe fires a payment_intent.succeeded webhook to your server → your server updates the order. Card data never touches your server.

What is a payment sequence diagram used for?

It documents the exact order of messages during checkout — useful for implementation docs, security reviews, webhook design, and debugging payment failures in production.

Can I edit this payment processing diagram?

Yes — click Open in Editor above. Modify participants, add your own services, adapt to PayPal or another provider, then export as PNG, SVG, or Mermaid. Free, no account needed.

Why does the webhook come before the frontend confirmation?

Webhooks are the authoritative payment signal — they arrive asynchronously from Stripe after the card is charged. The frontend shouldn't assume payment succeeded based on the checkout redirect alone; it should wait for the webhook to update order state, then display confirmation.

Map your own checkout flow

Type your payment steps, get a live diagram. Export PNG, SVG, or Mermaid. Free — no account needed.

Open Editor Free →