Skip to main content
GET
/
api
/
v2
/
storefront
/
cart
Retrieve a Cart
curl --request GET \
  --url https://demo.spreecommerce.org/api/v2/storefront/cart \
  --header 'X-Spree-Order-Token: <api-key>'
{
  "data": {
    "id": "1",
    "type": "cart",
    "attributes": {
      "number": "R123456789",
      "token": "eL0nVxe1Aum-Qr9-UkryPA1633360128076",
      "item_total": "19.99",
      "subtotal_cents": 1999,
      "store_credit_total_cents": 0,
      "total": "29.99",
      "total_cents": 2999,
      "total_minus_store_credits": "29.99",
      "total_minus_store_credits_cents": 2999,
      "ship_total": "5.0",
      "ship_total_cents": 500,
      "adjustment_total": "10.0",
      "created_at": "2020-02-16T07:14:54.617Z",
      "updated_at": "2020-02-16T07:14:54.617Z",
      "completed_at": "2023-11-07T05:31:56Z",
      "included_tax_total": "5.00",
      "additional_tax_total": "5.0",
      "display_additional_tax_total": "$5.00",
      "tax_total": "10.0",
      "tax_total_cents": 1000,
      "currency": "USD",
      "state": "cart",
      "email": "[email protected]",
      "display_item_total": "$19.99",
      "display_ship_total": "$19.99",
      "display_adjustment_total": "$10.00",
      "display_included_tax_total": "$5.00",
      "promo_total": "-10.0",
      "promo_total_cents": -1000,
      "display_promo_total": "-$10.00",
      "item_count": 2,
      "special_instructions": "Please wrap it as a gift",
      "display_total": "$29.99",
      "display_total_minus_store_credits": "$29.99",
      "pre_tax_item_amount": "17.00",
      "display_pre_tax_item_amount": "$17.00",
      "pre_tax_total": "20.00",
      "display_tax_total": "$10.00",
      "display_pre_tax_total": "$20.00",
      "shipment_state": "pending",
      "payment_state": "balance_due"
    },
    "relationships": {
      "line_items": {
        "data": [
          {
            "id": "<string>",
            "type": "<string>"
          }
        ]
      },
      "variants": {
        "data": [
          {
            "id": "<string>",
            "type": "<string>"
          }
        ]
      },
      "promotions": {
        "data": [
          {
            "id": "<string>",
            "type": "<string>"
          }
        ]
      },
      "payments": {
        "data": [
          {
            "id": "<string>",
            "type": "<string>"
          }
        ]
      },
      "shipments": {
        "data": [
          {
            "id": "<string>",
            "type": "<string>"
          }
        ]
      },
      "user": {
        "data": {
          "id": "<string>",
          "type": "<string>"
        }
      },
      "billing_address": {
        "data": {
          "id": "<string>",
          "type": "<string>"
        }
      },
      "shipping_address": {
        "data": {
          "id": "<string>",
          "type": "<string>"
        }
      }
    }
  },
  "included": [
    {
      "id": "1",
      "type": "line_item",
      "attributes": {
        "name": "Sample product",
        "quantity": 1,
        "slug": "sample-product",
        "options_text": "Size: small, Color: red",
        "price": "125.0",
        "currency": "USD",
        "display_price": "$125.00",
        "total": "250.0",
        "display_total": "$250.00",
        "adjustment_total": "10.0",
        "display_adjustment_total": "$10.00",
        "additional_tax_total": "5.0",
        "display_additional_tax_total": "$5.00",
        "discounted_amount": "125.0",
        "display_discounted_amount": "$125.00",
        "pre_tax_amount": "125.0",
        "display_pre_tax_amount": "$125.00",
        "promo_total": "-5.0",
        "display_promo_total": "<string>",
        "included_tax_total": "0.0",
        "display_inluded_tax_total": "$0.00",
        "compare_at_amount": "290.99",
        "display_compare_at_amount": "$290.99",
        "public_metadata": {
          "recommended_by_us": true
        }
      },
      "relationships": {
        "variant": {
          "data": {
            "id": "<string>",
            "type": "<string>"
          }
        },
        "digital_links": {
          "data": [
            {
              "id": "<string>",
              "type": "<string>"
            }
          ]
        }
      }
    }
  ]
}

Authorizations

X-Spree-Order-Token
string
header
required

Order token to authorize Cart and Checkout requests.

How to obtain X-Spree-Order-Token

Query Parameters

include
string

Specify the related resources you would like to receive in the response body. More Information.

fields[cart]
string

Specify the fields you would like returned in the response body. More information.

currency
string

Must be specified when is different than current store default currency.

Response

200 Success - Returns the cart object.

data
Cart · object
required

The Cart provides a central place to collect information about an order, including line items, adjustments, payments, addresses, and shipments. Read more in Spree docs

included
(Line Item · object | Promotion · object | Variant · object | Payment · object | User · object | Shipment · object | Digital Link · object | Product · object)[]