Create a Cart
POST/v2/carts
Creates a cart. Call this endpoint each time a customer creates a cart.
Each shopper can have multiple carts. Use the carts API to create a cart. The carts are distinct from one another. Shoppers can add different items to their carts. They can check out one of the carts without affecting the content or status of their other carts.
After the shopper checks out the cart, the cart remains available to the shopper. The cart is persistent and stays with the shopper after it is used.
You can also create a cart to specify custom discounts. You can enable custom discounts when the discount_settings.custom_discounts_enabled
field is set to true
. Default is set from cart discount settings for the store. See Update Cart Settings.
Request
Header Parameters
A customer token to be associated with the cart.
- application/json
Body
- MOD1
- MOD2
- MOD3
The cart description.
discount_settings object
This parameter enables custom discounts for a cart. When set to true, Elastic Path promotions will not be applied to the new carts. Default is set from cart discount settings for the store. See Cart Settings.
When set to true, this parameter allows the cart to use rule promotions.
The cart name provided by the shopper. A cart name must contain 1 to 255 characters. You cannot use whitespace characters, but special characters are permitted. For more information, see the Safe Characters section.
This optional parameter sets a reference date for the cart. If this parameter is set, it allows the cart to act as one that might occur on that specified date. For example, such future carts might acquire future-enabled discounts, allowing users to test and validate future interactions with carts. The snapshot_date must be in the format 2026-02-21T15:07:25Z. By default, this parameter is left empty.
custom_attributes object
custom_attributes object
Specifies the custom attributes for the cart object. The attribute can be any string, numerical, and underscore. A cart can have maximum of 20 custom attributes.
attribute object
Specifies the attribute type
and value
.
Specifies the type of the attribute such as string, integer, boolean, and float.
value object
Specifies the value of the attribute.
string
number
boolean
To remove the Stripe payment intent from a cart, pass the empty value in the payment_intent_id
field. You must use an empty value for this field. You cannot use this endpoint to directly update the cart to use an existing Payment Intent.
Responses
- 200
- 401
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
data object
The unique identifier for the cart. Use SDK or create it yourself.
The type of object being returned.
The name of this cart.
A description of the cart.
discount_settings object
This parameter enables custom discounts for a cart. When set to true, Elastic Path promotions will not be applied to the new carts. Default is set from cart discount settings for the store. See Cart Settings.
When set to true, this parameter allows the cart to use rule promotions.
Stripe-assigned unique identifier for the linked Payment Intent
links object
A link to that specific resource.
meta object
display_price object
with_tax object
The raw total of this cart.
The currency set for this cart.
The tax inclusive formatted total based on the currency.
without_tax object
The raw total of this cart.
The currency set for this cart.
The tax inclusive formatted total based on the currency.
tax object
The raw total of this cart.
The currency set for this cart.
The tax inclusive formatted total based on the currency.
discount object
The raw total of this cart.
The currency set for this cart.
The tax inclusive formatted total based on the currency.
without_discount object
The raw total of this cart.
The currency set for this cart.
The tax inclusive formatted total based on the currency.
shipping object
The raw total of this cart.
The currency set for this cart.
The tax inclusive formatted total based on the currency.
timestamps object
The date this was created.
The date this was last updated.
relationships object
customers object
data object
The type of related object.
The ID of the customer.
items object
data object
The type of related object.
The unique identifier for the cart item
{
"data": {
"id": "string",
"type": "string",
"name": "string",
"description": "string",
"discount_settings": {
"custom_discounts_enabled": true,
"use_rule_promotions": true
},
"payment_intent_id": "string",
"links": {
"self": "string"
},
"meta": {
"display_price": {
"with_tax": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"without_tax": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"tax": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"discount": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"without_discount": {
"amount": 0,
"currency": "string",
"formatted": "string"
},
"shipping": {
"amount": 0,
"currency": "string",
"formatted": "string"
}
},
"timestamps": {
"created_at": "string"
}
},
"relationships": {
"customers": {
"data": {
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
},
"items": {
"data": {
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}
}
}
}
Unauthorized
- application/json
- Schema
- Example (from schema)
- Example
Schema
[
null
]
{
"errors": {
"status": 401,
"title": "Unauthorized"
}
}