Search Documentation
Search for a documentation page...
Carts API
REST API endpoints for managing shopping carts.
Add to Cart / Create Cart
Creates a new cart or updates an existing one. To create a new cart, omit cartId. To add to an existing cart, include it. Setting quantity to 0 removes the item.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
variantId | string | Yes | Product variant UUID |
quantity | number | Yes | Quantity to set (0 removes the item) |
cartId | string | No | Existing cart UUID (omit to create new) |
subscriptionPlanId | string | No | Subscription plan ID for recurring items |
currency | string | No | Currency code for this cart (e.g. EUR). Validated against store's enabled currencies |
Response
Returns the complete cart with all line items:
Get Cart
Returns the full cart with all line items, product details, and computed totals.
Delete Cart
Permanently deletes a cart and all its line items.
Checkout Redirect
Redirects (HTTP 308) to the store's hosted checkout page for the given cart. Useful for headless integrations that need to hand off to the YNS checkout flow.
Remove Line Item
Removes a specific variant from the cart. Returns the updated cart.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
subscriptionPlanId | string | Match subscription plan when removing |
For subscription items, include the subscriptionPlanId to identify the correct line item.