Glue API: Retrieve gift cards in guest carts
Edit on GitHubThis document describes how to retrieve gift cards in guest carts using Glue API. To retrieve full information about guest carts, see Manage guest carts.
Installation
For detailed information on the modules that provide the API functionality and related installation instructions, see:
Retrieve a guest cart
To retrieve a guest cart, send the request:
GET
/guest-carts
Guest users have one guest cart by default. If you already have a guest cart, you can optionally specify its ID when adding items. To do that, use the following endpoint. The information in this section is valid for both of the endpoints.
GET
/guest-carts/{{guestCartId}}
PATH PARAMETER | DESCRIPTION |
---|---|
{{guestCartId}} | Unique identifier of the guest cart. To get it, retrieve a guest cart. |
When retrieving the cart with guestCartId
, the response includes a single object, and when retrieving the resource without specifying it, you get an array containing a single object.
Request
HEADER KEY | HEADER VALUE EXAMPLE | REQUIRED | DESCRIPTION |
---|---|---|---|
X-Anonymous-Customer-Unique-Id | 164b-5708-8530 | ✓ | Guest user’s unique identifier. For security purposes, we recommend passing a hyphenated alphanumeric value, but you can pass any. If you are sending automated requests, you can configure your API client to generate this value. |
PATH PARAMETER | DESCRIPTION | Possible values |
---|---|---|
include | Adds resource relationships to the request. |
|
GET https://glue.mysprykershop.com/guest-carts?include=gift-cards,vouchers
: Retrieve a guest cart with information about the gift cards applied.
Response sample: add items with gift cards to a guest cart
{
"data": [
{
"type": "guest-carts",
"id": "f8782b6c-848d-595e-b3f7-57374f1ff6d7",
"attributes": {
"priceMode": "GROSS_MODE",
"currency": "EUR",
"store": "DE",
"name": "Shopping cart",
"isDefault": true,
"totals": {
"expenseTotal": 0,
"discountTotal": 10689,
"taxTotal": 15360,
"subtotal": 106892,
"grandTotal": 96203,
"priceToPay": 93203
},
"discounts": [
{
"displayName": "10% Discount for all orders above",
"amount": 10689,
"code": null
}
],
"thresholds": []
},
"links": {
"self": "https://glue.mysprykershop.com/guest-carts/f8782b6c-848d-595e-b3f7-57374f1ff6d7"
},
"relationships": {
"gift-cards": {
"data": [
{
"type": "gift-cards",
"id": "GC-Z9FYJRK3-20"
}
]
}
}
}
],
"links": {
"self": "https://glue.mysprykershop.com/cart-codes?include=gift-cards"
},
"included": [
{
"type": "gift-cards",
"id": "GC-Z9FYJRK3-20",
"attributes": {
"code": "GC-Z9FYJRK3-20",
"name": "Gift Card 30",
"value": 3000,
"currencyIsoCode": "EUR",
"actualValue": 3000,
"isActive": true
},
"links": {
"self": "https://glue.mysprykershop.com/guest-carts/f8782b6c-848d-595e-b3f7-57374f1ff6d7/cart-codes/GC-Z9FYJRK3-20"
}
}
]
}
General cart information
RESOURCE | ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|---|
guest-carts | priceMode | String | Price mode that was active when the cart was created. |
guest-carts | currency | String | Currency that was selected when the cart was created. |
guest-carts | store | String | Store for which the cart was created. |
guest-carts | name | String | Name of the shopping cart. |
guest-carts | isDefault | Boolean | Defines whether the cart is default or not. |
Totals information
RESOURCE | ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|---|
guest-carts | expenseTotal | Integer | Total amount of expenses (including e.g. shipping costs). |
guest-carts | discountTotal | Integer | Total amount of discounts applied to the cart. |
guest-carts | taxTotal | Integer | Total amount of taxes to be paid. |
guest-carts | subTotal | Integer | Subtotal of the cart. |
guest-carts | grandTotal | Integer | Grand total of the cart. |
Discount information
RESOURCE | ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|---|
guest-carts | displayName | String | Discount name. |
guest-carts | code | String | Discount code applied to the cart. |
guest-carts | amount | Integer | Discount amount applied to the cart. |
Thresholds
RESOURCE | ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|---|
carts | threshold | Array | Thresholds applied. |
carts | type | String | Threshold type. |
carts | threshold | Integer | Threshold monetary amount. |
carts | fee | Integer | Fee to be paid if the threshold is not reached. |
carts | deltaWithSubtotal | Integer | Displays the remaining amount that needs to be added to pass the threshold. |
carts | message | String | Message shown to the customer if the threshold is not fulfilled. |
For the attributes of guest cart items, see Managing gift cards of guest users.
Possible errors
CODE | REASON |
---|---|
101 | Cart with given uuid not found. |
104 | Cart uuid is missing. |
109 | Anonymous customer unique id is empty. |
To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.
Thank you!
For submitting the form