examples/storefront Public
title: Checking out a cartdescription: >- The shopper checks out an open cart. storefront-api takes the stock and creates the order in one D1 batch, then asks the payments Worker for a PaymentIntent and hands its client secret to the browser, which confirms the payment with the Payment Element. Stripe reports the result to the payments Worker, which marks the order paid through OrdersService.actors: [shopper]steps: - { from: shopper, to: storefront-api, label: "POST /carts/:id/checkout, email and address" } - { from: storefront-api, to: db, label: read the cart and check the stock } - { from: storefront-api, to: db, label: "one batch: insert the order, take the stock, close the cart" } - { from: storefront-api, to: payments, label: "PaymentsService.createIntent(order, total)" } - { from: payments, to: stripe, label: create a PaymentIntent for the order total } - { from: storefront-api, to: db, label: save the PaymentIntent id on the order } - { from: storefront-api, to: shopper, label: the order and the client secret } - { from: shopper, to: stripe, label: confirm the payment with the Payment Element } - { from: stripe, to: payments, label: "payment_intent.succeeded, signed" } - { from: payments, to: storefront-api, label: "OrdersService.markPaid(order, intent)" } - { from: storefront-api, to: db, label: mark the order paid if it is still pending } - { from: shopper, to: storefront-api, label: "GET /orders/:id until it is paid" }