Rebasely Beta: data may be purged

examplesstorefront Public

Search the catalog with D1 full text search #4

Changed files

21 files changed404 additions24 deletionssince main at f6403bb

Checking out a cart

Not changed by this pull request.

  • Added
  • Rerouted, relabelled or moved
  • Removed

The shopper checks out an open cart. storefront-api takes the stock and creates the order in one D1 batch, then asks Stripe for a PaymentIntent and hands its client secret to the browser, which confirms the payment with the Payment Element. Stripe reports the result to stripe-webhook, which marks the order paid through OrdersService.

Checking out a cart: 11 steps between 5 participants Step 1: shopper to storefront-api, POST /carts/:id/checkout, email and addressPOST /carts/:id/checkout, ema…Step 2: storefront-api to db, read the cart and check the stockread the cart and check the s…Step 3: storefront-api to db, one batch: insert the order, take the stock, close the cartone batch: insert the order, …Step 4: storefront-api to stripe, create a PaymentIntent for the order totalcreate a PaymentIntent for the order totalStep 5: storefront-api to db, save the PaymentIntent id on the ordersave the PaymentIntent id on …Step 6: storefront-api to shopper, the order and the client secretthe order and the client secr…Step 7: shopper to stripe, confirm the payment with the Payment Elementconfirm the payment with the Payment ElementStep 8: stripe to stripe-webhook, payment_intent.succeeded, signedpayment_intent.succeeded, sig…Step 9: stripe-webhook to storefront-api, OrdersService.markPaid(order, intent)OrdersService.markPaid(order, intent)Step 10: storefront-api to db, mark the order paid if it is still pendingmark the order paid if it is …Step 11: shopper to storefront-api, GET /orders/:id until it is paidGET /orders/:id until it is p…shoppershopperActorstorefront-apistorefront-apiWorkerdbdbD1 databasestripestripeExternalstripe-webhookstripe-webhookWorker

The flow checkout at the head of this pull request, numbered in its order, with the steps it adds, reroutes, relabels, moves and removes. A removed step has no number.

Steps

  1. Step 1: shopper → storefront-api POST /carts/:id/checkout, email and address
  2. Step 2: storefront-api → db read the cart and check the stock
  3. Step 3: storefront-api → db one batch: insert the order, take the stock, close the cart
  4. Step 4: storefront-api → stripe create a PaymentIntent for the order total
  5. Step 5: storefront-api → db save the PaymentIntent id on the order
  6. Step 6: storefront-api → shopper the order and the client secret
  7. Step 7: shopper → stripe confirm the payment with the Payment Element
  8. Step 8: stripe → stripe-webhook payment_intent.succeeded, signed
  9. Step 9: stripe-webhook → storefront-api OrdersService.markPaid(order, intent)
  10. Step 10: storefront-api → db mark the order paid if it is still pending
  11. Step 11: shopper → storefront-api GET /orders/:id until it is paid

Knowledge base

Back to the conversation