Assumptions:
- account creation and authentication are already being handled
- endpoint for adding products to cart already exist
- customer has items in the cart
- cart is persisted between sessions if user is logged in
GET /new-session
Response { sessionID: “some uuid” }
Workout totals:
- item price * quantity
- calculate tax
- return total, subtotal, tax, shipping cost
POST /checkout/add-address
Link address to checkout Link address to billing details
Seen payment details to stripe Store the stripe payment method ID Ask stripe to add an authorisation on the card with the order total, plus 3D secure if needed
When product is about to ship, ask Stripe to finalise the payment