Checkout flow
The full path from an empty basket to a fulfilled order, and the API calls at each step.
This guide describes the requests a storefront makes to take a customer from browsing to a completed order.
Overview
Build the basket
- Create a basket when the customer adds their first product. Store the basket
idon the device. - Add products. Products that need more input have their own endpoints: Select seats for ticketing products and Select time slot for products that are collected or delivered in a time slot.
- Change the basket with Update line item quantity and Delete line item.
- Apply a voucher with Add voucher to basket.
Each of these requests is asynchronous. Poll the notification, then read the basket to show the new totals.
Collect customer and delivery details
- Read
missingCustomerDetailFieldson the basket. It lists the customer details that the providers in the basket still need. - Send them with Set customer details.
- For each provider basket that needs one, choose a delivery method with Set delivery method.
- If the customer signs in at this point, call Assign contact.
Create a payment intent
Call Create a payment intent when the customer chooses to pay.
OneBasket tells each provider in the basket that a payment is about to be made. A provider can lock inventory at this point, or reject the payment. From now on the basket is immutable.
If the customer goes back to change the basket, call Cancel a payment intent. The basket becomes mutable again.
Take payment
Take payment with the payment provider configured for your store, such as Worldpay, CyberSource, Adyen or Stripe. Each provider has its own client SDK and its own Storefront endpoints. See Payments.
The payment intent moves through these statuses:
| Status | Meaning |
|---|---|
PreparingPayment | OneBasket is preparing the payment with the providers and the payment provider. |
AwaitingPayment | The payment intent is ready. The customer can enter payment details. |
PaymentComplete | The payment provider confirmed the payment. |
Cancelled | The payment intent was cancelled. The basket is mutable again. |
Confirm the order
When OneBasket receives confirmation of the payment, the basket is complete and becomes an order. The order id is the same as the basket id.
Order processing is asynchronous. Show the customer a message such as "Your order has been received" straight away, then call Get order status to follow progress:
{
"id": "...",
"processingCompleted": true,
"hasRejections": false
}| Field | Meaning |
|---|---|
processingCompleted | true when every provider has confirmed or rejected its part of the order. |
hasRejections | true when at least one provider rejected its part of the order. |
Order processing states
An order contains one provider order for each provider. OneBasket sends each provider order to its provider and tracks its processing state.
| State | Meaning |
|---|---|
| Sent | The order was sent to the provider system. OneBasket is waiting for a reply. |
| Confirmed | The provider accepted the order. Fulfilment will begin. |
| Rejected | The provider rejected the order. A compensating action is needed, such as manual intervention or a refund. |
Fulfilment states
After a provider confirms an order, fulfilment begins. Providers that support two-way communication report fulfilment progress back to OneBasket. For a food and beverage order collected from a kiosk, the states are:
| State | Meaning |
|---|---|
| Received | The order was received for fulfilment. Preparation has not started. |
| In progress | The order is being prepared. |
| Ready | The order is ready. The customer can collect it from the kiosk. |
| Fulfilled | The customer collected the order. |
After the purchase
- Show past orders with Get all orders.
- Show tickets, forward them and create wallet passes with the Ticketing API.