Retrieving Customer's Order History
  • Updated on 05 May 2020
  • 16 minutes to read
  • Print
  • Share
  • Dark
    Light

Retrieving Customer's Order History

  • Print
  • Share
  • Dark
    Light

For every registered customer, there is an order history retrievable. The list of orders, as well as detailed order information including every step of the calculation and addresses used in the orders, is available for retrieval.

In your development, this resource can help you to:

  • Make the order history available to customers
  • Make order details available to enable reordering functionality

The Order History API allows you to retrieve all orders made by a registered customer.

Authentication
Since order history is available for registered users only, the endpoints provided by the API cannot be accessed anonymously. For this reason, you always need to pass a user's authentication token in your REST requests. For details on how to authenticate a user and retrieve the token, see Authentication and Authorization.

Installation

For detailed information on the modules that provide the API functionality and related installation instructions, see:

Retrieving all Orders

To retrieve a list of all orders made by a registered customer, send the request:


GET /orders


Request

Request sample:
GET http://glue.mysprykershop.com/orders

Response

The endpoint responds with an array of orders placed by the authenticated customer. In the response, each order will have a unique identifier. It is specified in the id attribute. You can use the ID to retrieve detailed order information. Also, self links will be provided to access an order. individually using the REST API.

Response sample with one order
{
    "data": [
        {
            "type": "orders",
            "id": "DE--1",
            "attributes": {
                "createdAt": "2019-11-01 09:21:14.307061",
                "totals": {
                    "expenseTotal": 1000,
                    "discountTotal": 23286,
                    "taxTotal": 34179,
                    "subtotal": 236355,
                    "grandTotal": 214069,
                    "canceledTotal": 0
                },
                "currencyIsoCode": "EUR",
                "priceMode": "GROSS_MODE"
            },
            "links": {
                "self": "http://glue.mysprykershop.com/orders/DE--1"
            }
        }
    ],
    "links": {
        "self": "http://glue.mysprykershop.com/orders"
    }
}


Attribute* Type Description
createdAt String Date and time when the order was created.
expenseTotal Integer Total amount of expenses (e.g. shipping costs).
discountTotal Integer Total amount of discounts applied.
taxTotal Integer Total amount of taxes paid.
subtotal Integer Subtotal of the order.
grandTotal Integer Grand total of the order.
canceledTotal Integer Total canceled amount.
currencyIsoCode String ISO 4217 code of the currency that was selected when placing the order.
priceMode String Price mode that was active when placing the order. Possible values:
  • NET_MODE - prices before tax;
  • GROSS_MODE - prices after tax.

*Type and ID attributes are not mentioned.

Paging Through Orders

By default, the above request will return all orders placed by a customer. However, you can also enable paging and receive results in pages of a limited size. For this purpose, use the limit and offset parameters in your request:

URL Description
/orders Returns all orders made by a customer.
/orders?limit=10 Returns maximum 10 orders.
/orders?offset=10&limit=10 Returns orders 11 through 20.
/orders?offset=20 Returns all orders starting from the 21st to the end.

When paging is enabled, the links section of the JSON response will contain links for the first, previous, next and last pages.

View example
{
    "data": [
        {
            "type": "orders",
            "id": "DE--1",
            "attributes": {
                "createdAt": "2018-11-01 17:57:14.354849",
                "totals": {
                    "expenseTotal": 490,
                    "discountTotal": 30237,
                    "taxTotal": 42746,
                    "subtotal": 297470,
                    "grandTotal": 267723,
                    "canceledTotal": 0
                },
                "currencyIsoCode": "EUR",
                "priceMode": "GROSS_MODE"
            },
            "links": {
                "self": "http://glue.mysprykershop.com/orders/DE--1"
            }
        }
    ],
    "links": {
        "self": "http://glue.mysprykershop.com/orders?page[offset]=2&page[limit]=2",
        "last": "http://glue.mysprykershop.com/orders?page[offset]=2&page[limit]=2",
        "first": "http://glue.mysprykershop.com/orders?page[offset]=0&page[limit]=2",
        "prev": "http://glue.mysprykershop.com/orders?page[offset]=0&page[limit]=2"
    }
}


Retrieving an Order

To retrieve detailed information on an order, send the request:


GET /orders/{{order_id}}


Path parameter Description
order_id A unique identifier of an order. Retrieve all orders to get it.

Request

Request sample: GET http://glue.mysprykershop.com/orders/DE--1

Response

Response sample
{
    "data": {
        "type": "orders",
        "id": "DE--1",
        "attributes": {
            "createdAt": "2020-04-15 06:43:22.047277",
            "currencyIsoCode": "EUR",
            "priceMode": "GROSS_MODE",
            "totals": {
                "expenseTotal": 500,
                "discountTotal": 3925,
                "taxTotal": 4921,
                "subtotal": 34247,
                "grandTotal": 30822,
                "canceledTotal": 0
            },
            "billingAddress": {
                "salutation": "Ms",
                "firstName": "Sonia",
                "middleName": null,
                "lastName": "Wagner",
                "address1": "Kirncher Str.",
                "address2": "7",
                "address3": "",
                "company": "Spryker Systems GmbH",
                "city": "Berlin",
                "zipCode": "10247",
                "poBox": null,
                "phone": "4902890031",
                "cellPhone": null,
                "description": null,
                "comment": "",
                "email": null,
                "country": "Germany",
                "iso2Code": "DE"
            },
            "shippingAddress": {
                "salutation": "Ms",
                "firstName": "Sonia",
                "middleName": null,
                "lastName": "Wagner",
                "address1": "Kirncher Str.",
                "address2": "7",
                "address3": "",
                "company": "Spryker Systems GmbH",
                "city": "Berlin",
                "zipCode": "10247",
                "poBox": null,
                "phone": "4902890031",
                "cellPhone": null,
                "description": null,
                "comment": "",
                "email": null,
                "country": "Germany",
                "iso2Code": "DE"
            },
            "items": [
                {
                    "name": "Canon PowerShot N",
                    "sku": "035_17360369",
                    "sumPrice": 29747,
                    "quantity": 1,
                    "unitGrossPrice": 29747,
                    "sumGrossPrice": 29747,
                    "taxRate": "19.00",
                    "unitNetPrice": 0,
                    "sumNetPrice": 0,
                    "unitPrice": 29747,
                    "unitTaxAmountFullAggregation": 4275,
                    "sumTaxAmountFullAggregation": 4275,
                    "refundableAmount": 26772,
                    "canceledAmount": 0,
                    "sumSubtotalAggregation": 29747,
                    "unitSubtotalAggregation": 29747,
                    "unitProductOptionPriceAggregation": 0,
                    "sumProductOptionPriceAggregation": 0,
                    "unitExpensePriceAggregation": 0,
                    "sumExpensePriceAggregation": null,
                    "unitDiscountAmountAggregation": 2975,
                    "sumDiscountAmountAggregation": 2975,
                    "unitDiscountAmountFullAggregation": 2975,
                    "sumDiscountAmountFullAggregation": 2975,
                    "unitPriceToPayAggregation": 26772,
                    "sumPriceToPayAggregation": 26772,
                    "taxRateAverageAggregation": "19.00",
                    "taxAmountAfterCancellation": null,
                    "metadata": {
                        "superAttributes": [],
                        "image": "https://images.icecat.biz/img/gallery_mediums/17360369_3328.jpg"
                    },
                    "salesUnit": null,
                    "calculatedDiscounts": [
                        {
                            "unitAmount": 2975,
                            "sumAmount": 2975,
                            "displayName": "10% Discount for all orders above",
                            "description": "Get a 10% discount on all orders above certain value depending on the currency and net/gross price. This discount is not exclusive and can be combined with other discounts.",
                            "voucherCode": null,
                            "quantity": 1
                        }
                    ],
                    "productOptions": [],
                    "amount": null
                },
                {
                    "name": "VGA cable as long as you want",
                    "sku": "cable-vga-1-2",
                    "sumPrice": 1500,
                    "quantity": 1,
                    "unitGrossPrice": 1500,
                    "sumGrossPrice": 1500,
                    "taxRate": "19.00",
                    "unitNetPrice": 0,
                    "sumNetPrice": 0,
                    "unitPrice": 1500,
                    "unitTaxAmountFullAggregation": 215,
                    "sumTaxAmountFullAggregation": 215,
                    "refundableAmount": 1350,
                    "canceledAmount": 0,
                    "sumSubtotalAggregation": 1500,
                    "unitSubtotalAggregation": 1500,
                    "unitProductOptionPriceAggregation": 0,
                    "sumProductOptionPriceAggregation": 0,
                    "unitExpensePriceAggregation": 0,
                    "sumExpensePriceAggregation": null,
                    "unitDiscountAmountAggregation": 150,
                    "sumDiscountAmountAggregation": 150,
                    "unitDiscountAmountFullAggregation": 150,
                    "sumDiscountAmountFullAggregation": 150,
                    "unitPriceToPayAggregation": 1350,
                    "sumPriceToPayAggregation": 1350,
                    "taxRateAverageAggregation": "19.00",
                    "taxAmountAfterCancellation": null,
                    "metadata": {
                        "superAttributes": [],
                        "image": null
                    },
                    "salesUnit": {
                        "conversion": 1,
                        "precision": 100,
                        "productMeasurementUnit": {
                            "name": "Meter",
                            "code": "METR"
                        }
                    },
                    "calculatedDiscounts": [
                        {
                            "unitAmount": 150,
                            "sumAmount": 150,
                            "displayName": "10% Discount for all orders above",
                            "description": "Get a 10% discount on all orders above certain value depending on the currency and net/gross price. This discount is not exclusive and can be combined with other discounts.",
                            "voucherCode": null,
                            "quantity": 1
                        }
                    ],
                    "productOptions": [],
                    "amount": "1.5000000000"
                },
                {
                    "name": "VGA cable as long as you want",
                    "sku": "cable-vga-1-2",
                    "sumPrice": 1500,
                    "quantity": 1,
                    "unitGrossPrice": 1500,
                    "sumGrossPrice": 1500,
                    "taxRate": "19.00",
                    "unitNetPrice": 0,
                    "sumNetPrice": 0,
                    "unitPrice": 1500,
                    "unitTaxAmountFullAggregation": 216,
                    "sumTaxAmountFullAggregation": 216,
                    "refundableAmount": 1350,
                    "canceledAmount": 0,
                    "sumSubtotalAggregation": 1500,
                    "unitSubtotalAggregation": 1500,
                    "unitProductOptionPriceAggregation": 0,
                    "sumProductOptionPriceAggregation": 0,
                    "unitExpensePriceAggregation": 0,
                    "sumExpensePriceAggregation": null,
                    "unitDiscountAmountAggregation": 150,
                    "sumDiscountAmountAggregation": 150,
                    "unitDiscountAmountFullAggregation": 150,
                    "sumDiscountAmountFullAggregation": 150,
                    "unitPriceToPayAggregation": 1350,
                    "sumPriceToPayAggregation": 1350,
                    "taxRateAverageAggregation": "19.00",
                    "taxAmountAfterCancellation": null,
                    "metadata": {
                        "superAttributes": [],
                        "image": null
                    },
                    "salesUnit": {
                        "conversion": 1,
                        "precision": 100,
                        "productMeasurementUnit": {
                            "name": "Meter",
                            "code": "METR"
                        }
                    },
                    "calculatedDiscounts": [
                        {
                            "unitAmount": 150,
                            "sumAmount": 150,
                            "displayName": "10% Discount for all orders above",
                            "description": "Get a 10% discount on all orders above certain value depending on the currency and net/gross price. This discount is not exclusive and can be combined with other discounts.",
                            "voucherCode": null,
                            "quantity": 1
                        }
                    ],
                    "productOptions": [],
                    "amount": "1.5000000000"
                },
                {
                    "name": "VGA cable as long as you want",
                    "sku": "cable-vga-1-2",
                    "sumPrice": 1500,
                    "quantity": 1,
                    "unitGrossPrice": 1500,
                    "sumGrossPrice": 1500,
                    "taxRate": "19.00",
                    "unitNetPrice": 0,
                    "sumNetPrice": 0,
                    "unitPrice": 1500,
                    "unitTaxAmountFullAggregation": 215,
                    "sumTaxAmountFullAggregation": 215,
                    "refundableAmount": 1350,
                    "canceledAmount": 0,
                    "sumSubtotalAggregation": 1500,
                    "unitSubtotalAggregation": 1500,
                    "unitProductOptionPriceAggregation": 0,
                    "sumProductOptionPriceAggregation": 0,
                    "unitExpensePriceAggregation": 0,
                    "sumExpensePriceAggregation": null,
                    "unitDiscountAmountAggregation": 150,
                    "sumDiscountAmountAggregation": 150,
                    "unitDiscountAmountFullAggregation": 150,
                    "sumDiscountAmountFullAggregation": 150,
                    "unitPriceToPayAggregation": 1350,
                    "sumPriceToPayAggregation": 1350,
                    "taxRateAverageAggregation": "19.00",
                    "taxAmountAfterCancellation": null,
                    "metadata": {
                        "superAttributes": [],
                        "image": null
                    },
                    "salesUnit": {
                        "conversion": 1,
                        "precision": 100,
                        "productMeasurementUnit": {
                            "name": "Meter",
                            "code": "METR"
                        }
                    },
                    "calculatedDiscounts": [
                        {
                            "unitAmount": 150,
                            "sumAmount": 150,
                            "displayName": "10% Discount for all orders above",
                            "description": "Get a 10% discount on all orders above certain value depending on the currency and net/gross price. This discount is not exclusive and can be combined with other discounts.",
                            "voucherCode": null,
                            "quantity": 1
                        }
                    ],
                    "productOptions": [],
                    "amount": "1.5000000000"
                }
            ],
            "expenses": [
                {
                    "type": "SHIPMENT_EXPENSE_TYPE",
                    "name": "Air Standard",
                    "sumPrice": 500,
                    "unitGrossPrice": 500,
                    "sumGrossPrice": 500,
                    "taxRate": "19.00",
                    "unitNetPrice": 0,
                    "sumNetPrice": 0,
                    "canceledAmount": null,
                    "unitDiscountAmountAggregation": null,
                    "sumDiscountAmountAggregation": null,
                    "unitTaxAmount": 0,
                    "sumTaxAmount": 0,
                    "unitPriceToPayAggregation": 0,
                    "sumPriceToPayAggregation": 0,
                    "taxAmountAfterCancellation": null
                }
            ],
            "payments": [
                {
                    "amount": 30822,
                    "paymentProvider": "DummyMarketplacePayment",
                    "paymentMethod": "Marketplace Invoice"
                }
            ],
            "shipments": [
                {
                    "shipmentMethodName": "Air Standard",
                    "carrierName": "Spryker Drone Shipment",
                    "deliveryTime": null,
                    "defaultGrossPrice": 500,
                    "defaultNetPrice": 0,
                    "currencyIsoCode": "EUR"
                }
            ],
            "calculatedDiscounts": [
                {
                    "unitAmount": null,
                    "sumAmount": 500,
                    "displayName": "Free standard delivery",
                    "description": "Free standard delivery for all orders above certain value depending on the currency and net/gross price. This discount is not exclusive and can be combined with other discounts.",
                    "voucherCode": null,
                    "quantity": 1
                },
                {
                    "unitAmount": null,
                    "sumAmount": 3425,
                    "displayName": "10% Discount for all orders above",
                    "description": "Get a 10% discount on all orders above certain value depending on the currency and net/gross price. This discount is not exclusive and can be combined with other discounts.",
                    "voucherCode": null,
                    "quantity": 4
                }
            ]
        },
        "links": {
            "self": "http://glue.mysprykershop.com/orders/DE--2"
        }
    }
}

General Order Information

Attribute* Type Description
createdAt String Date and time when the order was created.
currencyIsoCode String ISO 4217 code of the currency that was selected when placing the order.
priceMode String Price mode that was active when placing the order. Possible values:
  • NET_MODE - prices before tax;
  • GROSS_MODE - prices after tax.

Order Item Information

Attribute* Type Description
name String Name of the product.
sku String SKU of the product.
sumPrice Integer Sum of the prices.
sumPriceToPayAggregation Integer Sum of the prices to pay (after discounts).
quantity Integer Quantity of the product ordered.
superAttributes String Since the bought product is a concrete product, and super attributes are saved with the abstract product, this field is expected to stay empty.
image String URL to an image of the product.

Totals Calculations

Attribute Type Description
expenseTotal Integer Total amount of expenses (e.g. shipping costs).
discountTotal Integer Total amount of discounts applied.
taxTotal Integer Total amount of taxes paid.
subtotal Integer Subtotal of the order.
grandTotal Integer Grand total of the order
canceledTotal Integer Total canceled amount.

Order Item Information (for each item)

header header header
name String Product name.
cell String Product SKU.
sumPrice Integer Sum of all product prices.
sumPriceToPayAggregation Integer Sum of all prices to pay (after discounts were applied).
quantity Integer Product quantity ordered.
superAttributes String Always empty. Since products purchased are concrete products, and super attributes are available for abstract products, this field is expected to be empty at all times.
image String Product image URL.

Calculated Discounts for Items

Attribute* Type Description
unitAmount Integer Discount value applied to each order item of the corresponding product.
sumAmount Integer Sum of the discount values applied to the order items of the corresponding product.
displayName String Name of the discount applied.
description String Description of the discount.
voucherCode String Voucher code redeemed.
quantity String Number of discounts applied to the corresponding product.

Item Calculation

Attribute* Type Description
unitGrossPrice Integer Single item gross price.
sumGrossPrice Integer Sum of items gross price.
taxRate Integer Current tax rate, in percent.
unitNetPrice Integer Single item net price.
sumNetPrice Integer Sum total of net prices for all items.
unitPrice Integer Single item price without assuming if it is new or gross. This price should be displayed everywhere when a product price is displayed. It allows switching tax mode without side effects.
unitTaxAmountFullAggregation Integer Total tax amount for a given item, with additions.
sumTaxAmountFullAggregation Integer Total tax amount for a given sum of items, with additions.
refundableAmount Integer Available refundable amount for an item (order only).
canceledAmount Integer Total canceled amount for this item (order only).
sumSubtotalAggregation Integer Sum of subtotals of the items.
unitSubtotalAggregation Integer Subtotal for the given item.
unitProductOptionPriceAggregation Integer Item total product option price.
sumProductOptionPriceAggregation Integer Item total of product options for the given sum of items.
unitExpensePriceAggregation Integer Item expense total for a given item.
sumExpensePriceAggregation Integer Total amount of expenses for the given items.
unitDiscountAmountAggregation Integer Item total discount amount.
sumDiscountAmountAggregation Integer Sum of Item total discount amounts.
unitDiscountAmountFullAggregation Integer Sum of Item total discount amount.
sumDiscountAmountFullAggregation Integer Item total discount amount, with additions.
unitPriceToPayAggregation Integer Item total price to pay after discounts, with additions.
taxRateAverageAggregation Integer Item tax rate average, with additions. This value is used when recalculating the tax amount after cancellation.
taxAmountAfterCancellation Integer Tax amount after cancellation, recalculated using tax average.
uuid String Unique identifier of the order.
isReturnable Boolean Specifies whether the sales order item is returnable or not.

Product Options

Attribute* Type Description
sku String SKU of the product option.
optionName String Name of the product option.
optionGroupName String Name of the group that the product option belongs to.
price Integer Price for the product option.

Calculated Discounts

Attribute* Type Description
unitAmount Integer Amount of the discount provided by the given item for each unit of the product, in cents.
sumAmount Integer Total amount of the discount provided by the given item, in cents.
displayName String Display name of the given discount.
description String Description of the given discount.
voucherCode String Voucher code applied, if any.
quantity String Number of times the discount was applied.

Expenses

Attribute* Type Description
type String Expense type.
name String Expense name.
sumPrice Integer Sum of expenses calculated.
unitGrossPrice Integer Single item's gross price.
sumGrossPrice Integer Sum of items' gross price.
taxRate Integer Current tax rate in percent.
unitNetPrice Integer Single item net price.
sumNetPrice Integer Sum of items' net price.
canceledAmount Integer Total canceled amount for this item (order only).
unitDiscountAmountAggregation Integer Item total discount amount.
sumDiscountAmountAggregation Integer Sum of items' total discount amount.
unitTaxAmount Integer Tax amount for a single item, after discounts.
sumTaxAmount Integer Tax amount for a sum of items (order only).
unitPriceToPayAggregation Integer Item total price to pay after discounts with additions.
sumPriceToPayAggregation Integer Sum of items' total price to pay after discounts with additions.
taxAmountAfterCancellation Integer Tax amount after cancellation, recalculated using tax average.

Measurement unit calculations

Attribute* Type Description
salesUnit Object List of attributes defining the sales unit to be used for item amount calculation.
conversion integer Factor to convert a value from sales to base unit. If it is "null", the information is taken from the global conversions.
precision integer Ratio between a sales unit and a base unit.
measurementUnit string Code of the measurement unit.
name String Name of the measurement unit.
code String Code of the measurement unit.

Billing and Shipping Addresses

Attribute* Type Description
salutation String Salutation to use when addressing the customer.
firstName String Customer's first name.
lastName String Customer's last name.
address1 String The 1st line of the customer's address.
address2 String The 2nd line of the customer's address.
address3 String The 3rd line of the customer's address.
zipCode String ZIP code.
city String Specifies the city.
country String Specifies the country.
poBox String PO Box to use for communication.
company String Specifies the customer's company.
phone String Specifies the customer's phone number.
cellPhone String Mobile phone number.
email String Email address to use for communication.
isDefaultShipping String Specifies whether the address should be used as the default shipping address of the customer:
  • If the parameter is not set, the default value is true.
  • If the customer does not have a default shipping address, the value is true.
isDefaultBilling String Specifies whether the address should be used as the default billing address of the customer
  • If the parameter is not set, the default value is true.
  • If the customer does not have a default billing address, the value is true.
.
iso2Code String ISO 2-Letter Country Code to use.
description String Address description.
comment String Address comment.

Payments

Attribute* Type Description
amount Integer Amount paid via the corresponding payment provider in cents.
paymentProvider String Name of the payment provider.
paymentMethod String Name of the payment method.

Shipments

Attribute* Type Description
shipmentMethodName String Shipment method name.
carrierName String Shipment method name.
deliveryTime DateTimeUtc Desired delivery time, if available.
defaultGrossPrice Integer Default gross price of delivery, in cents.
defaultNetPrice Integer Default net price of delivery, in cents.
currencyIsoCode String ISO 4217 code of the currency in which the prices are specified.

*Type and ID attributes are not mentioned.

Was this article helpful?