Carts
Endpoints
POST /api/v1/carts
Create a cart for a session. If an existing cart is already keyed to the session, it is returned instead of creating a duplicate.
Scoped API key. Scopes: read, commerce, admin.
Caller-chosen session identifier to key the cart to
Existing cart for this session returned
A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.
Caller-supplied session identifier the cart is keyed to
activeOffer currently applied to the cart (via promo code or auto-apply), null when none
Sum of line totals before discounts
Discount from the applied offer
subtotalCents − discountCents (never negative)
Cart created
Validation error
GET /api/v1/carts/{id}
Scoped API key. Scopes: read, commerce, admin.
Cart ID
Cart details
A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.
Caller-supplied session identifier the cart is keyed to
activeOffer currently applied to the cart (via promo code or auto-apply), null when none
Sum of line totals before discounts
Discount from the applied offer
subtotalCents − discountCents (never negative)
Cart not found
POST /api/v1/carts/{id}/items
Add an item to a cart. Cart totals are recalculated and any auto-apply offer that improves the discount is applied.
Scoped API key. Scopes: read, commerce, admin.
Cart ID
Catalog product this line maps to
1Item added — returns the updated cart with recalculated totals
A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.
Caller-supplied session identifier the cart is keyed to
activeOffer currently applied to the cart (via promo code or auto-apply), null when none
Sum of line totals before discounts
Discount from the applied offer
subtotalCents − discountCents (never negative)
Validation error
Cart not found
DELETE /api/v1/carts/{id}/items/{itemId}
Remove an item from a cart. Cart totals and offer discounts are recalculated.
Scoped API key. Scopes: read, commerce, admin.
Cart ID
Cart item ID
Item removed — returns the updated cart with recalculated totals
A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.
Caller-supplied session identifier the cart is keyed to
activeOffer currently applied to the cart (via promo code or auto-apply), null when none
Sum of line totals before discounts
Discount from the applied offer
subtotalCents − discountCents (never negative)
Cart not found
DELETE /api/v1/carts/{id}/promo
Scoped API key. Scopes: read, commerce, admin.
Cart ID
Offer removed — returns the updated cart
A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.
Caller-supplied session identifier the cart is keyed to
activeOffer currently applied to the cart (via promo code or auto-apply), null when none
Sum of line totals before discounts
Discount from the applied offer
subtotalCents − discountCents (never negative)
Cart not found
POST /api/v1/carts/{id}/promo
Apply an offer (promo) code to a cart. The offer is validated against the cart contents before it is applied.
Scoped API key. Scopes: read, commerce, admin.
Cart ID
Offer code to apply
Offer applied — returns the updated cart plus an offer summary with the discount amount
A cart with its line items and computed totals. Totals are recalculated server-side on every item change, including any applicable offer discount.
Caller-supplied session identifier the cart is keyed to
activeOffer currently applied to the cart (via promo code or auto-apply), null when none
Sum of line totals before discounts
Discount from the applied offer
subtotalCents − discountCents (never negative)
Offer is not valid for this cart (offer_invalid) or validation error
Cart not found, or no offer matches the code
Last updated
Was this helpful?
