Skip to main content

Cart API overview

With the Cart API, Rokt partners can add additional products to a customer's cart within a transaction. The Cart API works with the Web SDK to help render frontend placements and provide hooks to update a customer's cart. There are two integrations needed to power upsells through Rokt:

  1. Integrate your backend cart/checkout system with the Rokt Cart API (this documentation).
  2. Integrate the Web SDK into your cart frontend.

A parking spot is a good example of a Rokt add-to-cart product. For example, a ticketing partner can upsell parking spots to their customers while they are purchasing event tickets. These parking spots are sourced through a third-party parking provider.

In-transaction request flow#

To fulfill customer orders, partners need to adhere to the following transaction flow.

In-Transaction Request Flow

  1. Call /placements/any to determine whether there are any placements to display, so you can skip the cross-sell/upsell stage if not there are no relevant offers.
  2. Based on whether /placements/any returns true or false, you can choose to show or skip the upsell page in the transaction flow. On the upsell page, you must initialize the Web SDK, which requests and displays available placements.
  3. Once a customer opts in, the Web SDK informs the partner's frontend by calling updateItemCallback. Then the normal purchase process proceeds.
  4. Call /cart/reserve to reserve 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.
  5. Once a customer pays for the items, call /cart/confirm to confirm the successful purchase of the items. Rokt then informs the relevant provider of the products for fulfillment.
    1. To cancel a reservation, call /cart/release. This is optional as reserved items that are not confirmed are automatically released after a timeout. This is suitable for high-traffic partners that require prompt release of reserved items.
    2. To cancel a confirmed item, call /confirmation/cancel. This is suitable for partners who want to cancel an item after it has been confirmed.
Was this article helpful?