Events
The events OneBasket emits during the lifecycle of a basket and an order.
OneBasket emits events as baskets and orders change. Server-side integrations use them to react to a customer's progress through checkout and to order processing.
Subscribing to events
Events are delivered to server-side integrations, not to browsers or apps. Contact your Stadion technical contact to set up a subscription.
Basket events
| Event | Emitted when |
|---|---|
BasketCreated | A new basket is created. This is the state of a basket before any product is added. |
BasketUpdated | Any provider basket in the basket is updated. It is emitted at the end of an asynchronous change, such as adding a product. |
BasketDeleted | A basket is deleted. Storefronts call this "emptying" the basket. |
PaymentIntentCreated | The basket is prepared for payment. OneBasket uses this event to coordinate the payment system and to tell each provider that a payment will be made. A provider can lock inventory or reject the payment. The basket is immutable from this point, unless the payment intent is deleted before payment arrives. |
PaymentIntentDeleted | The customer backed out of payment. The basket is mutable again, so the customer can change quantities or add another product. |
BasketComplete | OneBasket received confirmation of the payment from the payment provider. The basket is permanently immutable. The Orders service receives this event and starts order processing. |
Order events
| Event | Emitted when |
|---|---|
OrderProcessingCompleted | Every provider has confirmed or rejected its part of the order. Read the per-provider details to find the cause of a rejection. |
How events relate to the Storefront API
| Storefront request | Resulting event |
|---|---|
| Create a basket | BasketCreated |
| Any request that changes a basket | BasketUpdated |
| Delete a basket | BasketDeleted |
| Create a payment intent | PaymentIntentCreated |
| Cancel a payment intent | PaymentIntentDeleted |
| Payment confirmed by the payment provider | BasketComplete, then OrderProcessingCompleted |