Skip to main content

Baskets

These events allow your system to hook into different facets of a basket's lifecycle, from creation through to final completion.

EventDetailsModel
BasketCreatedEmitted when a new basket is created. This is the initial state of a basket before API consumers add products to it.
BasketUpdatedEmitted when any of provider baskets in the top level basket are updated. This is fired at the end of asynchronous operations to mutate the basket, such as addin a product to the basket.
BasketDeletedEmitted when a basket is deleted. Frontends refer to this as "emptied".
PaymentIntentCreated

Emitted when the basket is prepared for payment. This event is used to orchestrate the external payment systems, as well as notify the providers in the basket that a payment will be made, providing an opportunity to lock inventory, or reject the payment process if necessary. Once a payment intent has been created against a basket, it becomes immutable, unless the payment intent is deleted before a payment arrives from the payment provider system.

From a UI perspective, after this point where the user has declared they want to pay for their basket, and the only thing left to do is enter payment information.

PaymentIntentDeleted

Emitted when the basket is prepared for payment. This event is used to orchestrate the external payment systems, as well as notify the providers in the basket that a payment will be made, providing an opportunity to lock inventory, or reject the payment process if necessary.

From a UI perspective, this is called when the user backs out of a payment. The basket becomes mutable again. For example, if the user wants to back out and decrease inventory, or add another product before paying for the basket.

BasketComplete

Emitted once OneBasket recieves confirmation of the payment from the payment provider system.

At this point, the basket is forever immutable. Internally, this event is picked up by the Orders service where post payment processing begins.