The Add to Cart API provides Rokt Partners with the ability to add additional products to the cart within a transaction. It works in concert with the Web SDK, which provides the ability to render front-end placements and provides hooks to update the partner's cart. There are two integrations needed to power upsells through Rokt:
- Integrate your back-end cart/check-out system with the Rokt Add to Cart API (this documentation).
- Integrate the Web SDK into your cart front-end (Web SDK documentation).
An example of a Rokt add-to-cart product is a parking spot. A ticketing partner, for example, can upsell parking spots to their customers while they are purchasing event tickets. These parking spots are sourced through Arrive.
In-transaction request flow
To be able to fulfil customer orders partners need to adhere to the following transaction flow.
- Call /placements/any to determine whether there are any placements to display, and potentially skip the upsell stage if applicable.
- Based on whether /placements/any returns true or false the partner can choose to show or skip the upsell page in the transaction flow. On the upsell page partner must initialize Web SDK, which will request and display available placements.
- Once a user opts-in the Web SDK informs the partner's front-end by calling updateItemCallback. Then the normal purchase process proceeds.
- Call /cart/reserve to reserve/hold the items for a set period of time during which the purchase must be completed and confirmed with Rokt. If multiple cart items are passed into this method, some of them might be reserved successfully, and some might be rejected.
- Once a user pays for the items, call /cart/confirm to confirm the successful purchase of the items. Rokt will then inform the relevant provider of the products for fulfilment.
- Alternative: Call /cart/release to cancel a reservation on a set of items. This is optional as reserved items that are not confirmed are automatically released after a timeout. This is suitable for partners with high traffic periods requiring prompt release of reserved items.
- Alternative: Call /confirmation/cancel to cancel an item that has been confirmed. This is suitable for partners who want to cancel items after it is confirmed.