This document describes how to retrieve gift cards in carts of registered users using Glue API. To retrieve full information about carts of registered users, see Manage carts of registered users.
Installation
Retrieve registered user’s carts
To retrieve all carts, send the request:
GET
/carts
Note
Alternatively, you can retrieve all carts belonging to a customer through the /customers/{{customerId}}/carts endpoint. For details, see Retrieve customer carts.
Request
QUERY PARAMETER |
DESCRIPTION |
EXEMPLARY VALUES |
include |
Adds resource relationships to the request. |
gift-cards |
GET https://glue.mysprykershop.com/carts?include=gift-cards
: Retrieve all carts of a user with applied gift cards.
Response
Response sample with gift cards applied
{
"data": [
{
"type": "carts",
"id": "e877356a-5d8f-575e-aacc-c790eeb20a27",
"attributes": {
"priceMode": "GROSS_MODE",
"currency": "EUR",
"store": "DE",
"name": "Everyday purchases",
"isDefault": true,
"totals": {
"expenseTotal": 0,
"discountTotal": 17145,
"taxTotal": 19408,
"subtotal": 171447,
"grandTotal": 154302,
"priceToPay": 54302
},
"discounts": [
{
"displayName": "10% Discount for all orders above",
"amount": 17145,
"code": null
}
],
"thresholds": []
},
"links": {
"self": "https://glue.mysprykershop.com/carts/e877356a-5d8f-575e-aacc-c790eeb20a27"
},
"relationships": {
"gift-cards": {
"data": [
{
"type": "gift-cards",
"id": "GC-23RLC8H1-20"
}
]
}
}
}
],
"links": {
"self": "https://glue.mysprykershop.com/carts?include=vouchers,gift-cards"
},
"included": [
{
"type": "gift-cards",
"id": "GC-23RLC8H1-20",
"attributes": {
"code": "GC-23RLC8H1-20",
"name": "Gift Card 1000",
"value": 100000,
"currencyIsoCode": "EUR",
"actualValue": 100000,
"isActive": true
},
"links": {
"self": "https://glue.mysprykershop.com/carts/e877356a-5d8f-575e-aacc-c790eeb20a27/cart-codes/GC-23RLC8H1-20"
}
}
]
}
RESOURCE |
ATTRIBUTE |
TYPE |
DESCRIPTION |
carts |
currency |
String |
Currency that was selected when the cart was created. |
carts |
isDefault |
Boolean |
Specifies whether the cart is the default one for the customer. The field is available in multi-cart environments only. |
carts |
name |
String |
Specifies a cart name. The field is available in multi-cart environments only. |
carts |
priceMode |
String |
Price mode that was active when the cart was created. |
carts |
store |
String |
Store for which the cart was created. |
RESOURCE |
ATTRIBUTE |
TYPE |
DESCRIPTION |
carts |
displayName |
String |
Discount name. |
carts |
amount |
Integer |
Discount amount applied to the cart. |
carts |
code |
String |
Discount code applied to the cart. |
Totals
RESOURCE |
ATTRIBUTE |
TYPE |
DESCRIPTION |
carts |
expenseTotal |
String |
Total amount of expenses (including, e.g., shipping costs). |
carts |
discountTotal |
Integer |
Total amount of discounts applied to the cart. |
carts |
taxTotal |
Integer |
Total amount of taxes to be paid. |
carts |
subTotal |
Integer |
Subtotal of the cart. |
carts |
grandTotal |
Integer |
Grand total of the cart. |
carts |
priceToPay |
Integer |
Total price of the cart to pay after discounts. |
carts |
selectedProductOptions |
array |
List of attributes describing the product options that were added to cart with the product. |
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 included attributes of gift cards, see Managing Gift Cards of Registered Users.
Retrieve a registered user’s cart
To retrieve a particular cart, send the request:
GET
/carts/{{cart_uuid}}
Request
QUERY PARAMETER |
DESCRIPTION |
EXEMPLARY VALUES |
include |
Adds resource relationships to the request. |
gift-cards |
| GET https://glue.mysprykershop.com/carts/8ef901fe-fe47-5569-9668-2db890dbee6d?include=gift-cards | Retrieve the 8ef901fe-fe47-5569-9668-2db890dbee6
cart with detailed information on its gift cards. |
Response
Response sample with details on gift cards
{
"data": {
"type": "carts",
"id": "8ef901fe-fe47-5569-9668-2db890dbee6d",
"attributes": {
"priceMode": "GROSS_MODE",
"currency": "EUR",
"store": "DE",
"name": "Shopping cart",
"isDefault": true,
"totals": {
"expenseTotal": 0,
"discountTotal": 4200,
"taxTotal": 6035,
"subtotal": 42000,
"grandTotal": 37800,
"priceToPay": 17800
},
"discounts": [
{
"displayName": "10% Discount for all orders above",
"amount": 4200,
"code": null
}
]
},
"links": {
"self": "https://glue.mysprykershop.com/carts/8ef901fe-fe47-5569-9668-2db890dbee6d"
},
"relationships": {
"gift-cards": {
"data": [
{
"type": "gift-cards",
"id": "GC-I6UB6O56-20"
}
]
}
}
},
"included": [
{
"type": "gift-cards",
"id": "GC-I6UB6O56-20",
"attributes": {
"code": "GC-I6UB6O56-20",
"name": "Gift Card 200",
"value": 20000,
"currencyIsoCode": "EUR",
"actualValue": 20000,
"isActive": true
},
"links": {
"self": "https://glue.mysprykershop.com/carts/8ef901fe-fe47-5569-9668-2db890dbee6d/cart-codes/GC-I6UB6O56-20"
}
}
]
}
RESOURCE |
ATTRIBUTE |
TYPE |
DESCRIPTION |
carts |
currency |
String |
Currency that was selected when the cart was created. |
carts |
isDefault |
Boolean |
Specifies whether the cart is the default one for the customer. The field is available in multi-cart environments only. |
carts |
name |
String |
Specifies a cart name. The field is available in multi-cart environments only. |
carts |
priceMode |
String |
Price mode that was active when the cart was created. |
carts |
store |
String |
Store for which the cart was created. |
RESOURCE |
ATTRIBUTE |
TYPE |
DESCRIPTION |
carts |
displayName |
String |
Discount name. |
carts |
amount |
Integer |
Discount amount applied to the cart. |
carts |
code |
String |
Discount code applied to the cart. |
Totals
RESOURCE |
ATTRIBUTE |
TYPE |
DESCRIPTION |
carts |
expenseTotal |
String |
Total amount of expenses (including, e.g., shipping costs). |
carts |
discountTotal |
Integer |
Total amount of discounts applied to the cart. |
carts |
taxTotal |
Integer |
Total amount of taxes to be paid. |
carts |
subTotal |
Integer |
Subtotal of the cart. |
carts |
grandTotal |
Integer |
Grand total of the cart. |
carts |
priceToPay |
Integer |
Total price of the cart to pay after discounts. |
carts |
selectedProductOptions |
array |
List of attributes describing the product options that were added to cart with the product. |
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 the gift cards included resource, see Manage gift cards of registered users.
Possible errors
CODE |
REASON |
001 |
Access token is incorrect. |
002 |
Access token is missing. |
003 |
Failed to log in the user. |
101 |
Cart with given uuid not found. |
102 |
Failed to add an item to cart. |
103 |
Item with the given group key not found in the cart. |
104 |
Cart uuid is missing. |
115 |
Unauthorized cart action. |
To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.