OneBasket

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

  1. Create a basket when the customer adds their first product. Store the basket id on the device.
  2. 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.
  3. Change the basket with Update line item quantity and Delete line item.
  4. 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

  1. Read missingCustomerDetailFields on the basket. It lists the customer details that the providers in the basket still need.
  2. Send them with Set customer details.
  3. For each provider basket that needs one, choose a delivery method with Set delivery method.
  4. 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:

StatusMeaning
PreparingPaymentOneBasket is preparing the payment with the providers and the payment provider.
AwaitingPaymentThe payment intent is ready. The customer can enter payment details.
PaymentCompleteThe payment provider confirmed the payment.
CancelledThe 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
}
FieldMeaning
processingCompletedtrue when every provider has confirmed or rejected its part of the order.
hasRejectionstrue 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.

StateMeaning
SentThe order was sent to the provider system. OneBasket is waiting for a reply.
ConfirmedThe provider accepted the order. Fulfilment will begin.
RejectedThe 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:

StateMeaning
ReceivedThe order was received for fulfilment. Preparation has not started.
In progressThe order is being prepared.
ReadyThe order is ready. The customer can collect it from the kiosk.
FulfilledThe customer collected the order.

After the purchase

On this page