Retrieve gift cards in carts of registered users
Edit on GitHubThis 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
Alternatively, you can retrieve all carts belonging to a customer through the /customers/{{customerId}}/carts endpoint. For details, see Retrieve customer carts.
Request
HEADER KEY | HEADER VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
Authorization | string | ✓ | Alphanumeric string that authorizes the customer or company user to send requests to protected resources. Get it by authenticating as a customer or authenticating as a company user. |
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"
}
}
]
}
General Cart Information
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
priceMode | String | Price mode that was active when the cart was created. |
currency | String | Currency that was selected when the cart was created. |
store | String | Store for which the cart was created. |
name | String | Specifies a cart name. The field is available in multi-cart environments only. |
isDefault | Boolean | Specifies whether the cart is the default one for the customer. The field is available in multi-cart environments only. |
Discount Information
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
displayName | String | Discount name. |
amount | Integer | Discount amount applied to the cart. |
code | String | Discount code applied to the cart. |
Totals
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
expenseTotal | Integer | Total amount of expenses (including, e.g., shipping costs). |
discountTotal | Integer | Total amount of discounts applied to the cart. |
taxTotal | Integer | Total amount of taxes to be paid. |
subTotal | Integer | Subtotal of the cart. |
grandTotal | Integer | Grand total of the cart. |
selectedProductOptions | array | List of attributes describing the product options that were added to cart with the product. |
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}}
PATH PARAMETER | DESCRIPTION |
---|---|
{{cart_uuid}} | Unique identifier of a cart. Create a cart or Retrieve a registered user’s carts to get it. |
Request
HEADER KEY | HEADER VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
Authorization | string | ✓ | Alphanumeric string that authorizes the customer or company user to send requests to protected resources. Get it by authenticating as a customer or authenticating as a company user. |
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"
}
}
]
}
General Cart Information
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
priceMode | String | Price mode that was active when the cart was created. |
currency | String | Currency that was selected when the cart was created. |
store | String | Store for which the cart was created. |
name | String | Specifies a cart name. The field is available in multi-cart environments only. |
isDefault | Boolean | Specifies whether the cart is the default one for the customer. The field is available in multi-cart environments only. |
Discount Information
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
displayName | String | Discount name. |
amount | Integer | Discount amount applied to the cart. |
code | String | Discount code applied to the cart. |
Totals
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
expenseTotal | Integer | Total amount of expenses (including, e.g., shipping costs). |
discountTotal | Integer | Total amount of discounts applied to the cart. |
taxTotal | Integer | Total amount of taxes to be paid. |
subTotal | Integer | Subtotal of the cart. |
grandTotal | Integer | Grand total of the cart. |
selectedProductOptions | array | List of attributes describing the product options that were added to cart with the product. |
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.
Thank you!
For submitting the form