Get a Cart
GEThttps://useast.api.elasticpath.com/v2/carts/:cartID
Use this endpoint to retrieve a specific cart. If a cart ID does not exist, a new cart will be automatically created. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the relationships
section.
You can easily get a new or existing cart by providing the unique cart reference in the request. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the relationships section.
note
- The default cart name is Cart. However, you can update the cart name as required. Ensure that the string length of the name is greater than or equal to one. Follow the safe character guidelines for name and description naming. For more information about cart ID naming requirements, see the Safe Characters section.
- Outside of the JS-SDK, we don’t handle creating cart references. You need to create your own.
caution
An empty cart is returned for any carts that don’t currently exist. For more information about the cart items object, see Get Cart Items.
Query parameters
Name | Required | Type | Description |
---|---|---|---|
include | Optional | string | Comma-delimited string of entities that can be included. The information included are items ,tax_items , custom_discounts , or promotions . |
Request
Path Parameters
cartID stringrequired
The unique identifier for this cart that you created.
Responses
- 200
- 401
OK
- application/json
- Schema
- Example (from schema)
Schema
data object
{
"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
detail string
status string
title string
[
null
]
{
"errors": {
"status": 401,
"title": "Unauthorized"
}
}
Authorization: http
name: bearerAuthtype: httpscheme: bearer
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X GET 'https://useast.api.elasticpath.com/v2/carts/:cartID' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>'
ResponseClear