Getting the current cart
Learn how to get the active current cart for a specified token.
Last updated
Was this helpful?
Learn how to get the active current cart for a specified token.
Last updated
Was this helpful?
You must send a request to obtain the details of a shopper's currently active shopping cart. It will return a JSON response with all the relevant cart information, such as product details, pricing, and applicable taxes. The following sections provide step-by-step instructions on how to retrieve the active cart using a simple cURL command.
To get the current cart, send a request with the appropriate headers. Replace {Your_API_Key}
with your actual API key. Use the following cURL command to retrieve the active cart for a specified token:
curl --location -g --request GET ' https://api.digitalriver.com/v1/shoppers/me/carts/active' \
--header 'Accept: application/json' \
--header 'Authorization: Basic {Your_API_Key}' \
--header 'Content-Type: application/json'
{
"cart": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active",
"paymentMethods": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/payment-methods"
},
"webCheckout": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/web-checkout"
},
"id": 278666810197,
"lineItems": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items",
"lineItem": [
{
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items/14052737700",
"id": 14052737700,
"quantity": 1,
"product": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/products/8027217700",
"displayName": "Combination Product",
"thumbnailImage": null
},
"pricing": {
"listPrice": {
"currency": "USD",
"value": 36
},
"listPriceWithQuantity": {
"currency": "USD",
"value": 36
},
"salePriceWithQuantity": {
"currency": "USD",
"value": 36
},
"formattedListPrice": "$36.00",
"formattedListPriceWithQuantity": "$36.00",
"formattedSalePriceWithQuantity": "$36.00",
"productTax": {
"currency": "USD",
"value": 0
},
"shippingTax": {
"currency": "USD",
"value": 0
},
"feeTax": {
"currency": "USD",
"value": 0
},
"taxRate": 0.08525,
"importTax": {
"currency": "USD",
"value": 0
},
"formattedImportTax": "$0.00",
"importDuty": {
"currency": "USD",
"value": 0
},
"formattedImportDuty": "$0.00"
},
"components": {
"lineItem": [
{
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items/14052737700",
"id": 14052737700,
"quantity": 1,
"product": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/products/257734900",
"displayName": "Free trial product",
"thumbnailImage": null,
"recurringSubscriptionInfo": {
"autoRenewal": "true",
"termUnit": "WEEK",
"termLength": "1"
}
},
"pricing": {
"listPrice": {
"currency": "USD",
"value": 0
},
"listPriceWithQuantity": {
"currency": "USD",
"value": 0
},
"salePriceWithQuantity": {
"currency": "USD",
"value": 0
},
"formattedListPrice": "$0.00",
"formattedListPriceWithQuantity": "$0.00",
"formattedSalePriceWithQuantity": "$0.00",
"productTax": {
"currency": "USD",
"value": 0
},
"shippingTax": {
"currency": "USD",
"value": 0
},
"feeTax": {
"currency": "USD",
"value": 0
},
"taxRate": 0.08525,
"importTax": {
"currency": "USD",
"value": 0
},
"formattedImportTax": "$0.00",
"importDuty": {
"currency": "USD",
"value": 0
},
"formattedImportDuty": "$0.00"
}
},
{
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items/14052747700",
"id": 14052747700,
"quantity": 1,
"product": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/products/5505627700",
"displayName": "AK123_Physical",
"thumbnailImage": null
},
"pricing": {
"listPrice": {
"currency": "USD",
"value": 17
},
"listPriceWithQuantity": {
"currency": "USD",
"value": 17
},
"salePriceWithQuantity": {
"currency": "USD",
"value": 17
},
"formattedListPrice": "$17.00",
"formattedListPriceWithQuantity": "$17.00",
"formattedSalePriceWithQuantity": "$17.00",
"productTax": {
"currency": "USD",
"value": 1.45
},
"shippingTax": {
"currency": "USD",
"value": 4.26
},
"feeTax": {
"currency": "USD",
"value": 0
},
"taxRate": 0.08525,
"importTax": {
"currency": "USD",
"value": 0
},
"formattedImportTax": "$0.00",
"importDuty": {
"currency": "USD",
"value": 0
},
"formattedImportDuty": "$0.00"
}
},
{
"uri": "https://api.digitalriver.comi/v1/shoppers/me/carts/active/line-items/14052757700",
"id": 14052757700,
"quantity": 1,
"product": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/products/6686217700",
"displayName": "Auto_Monthly_Sub",
"thumbnailImage": null,
"recurringSubscriptionInfo": {
"autoRenewal": "true",
"termUnit": "MONTH",
"termLength": "1"
}
},
"pricing": {
"listPrice": {
"currency": "USD",
"value": 19
},
"listPriceWithQuantity": {
"currency": "USD",
"value": 19
},
"salePriceWithQuantity": {
"currency": "USD",
"value": 19
},
"formattedListPrice": "$19.00",
"formattedListPriceWithQuantity": "$19.00",
"formattedSalePriceWithQuantity": "$19.00",
"productTax": {
"currency": "USD",
"value": 0
},
"shippingTax": {
"currency": "USD",
"value": 0
},
"feeTax": {
"currency": "USD",
"value": 0
},
"taxRate": 0,
"importTax": {
"currency": "USD",
"value": 0
},
"formattedImportTax": "$0.00",
"importDuty": {
"currency": "USD",
"value": 0
},
"formattedImportDuty": "$0.00"
}
}
]
}
}
]
},
"totalItemsInCart": 3,
"businessEntityCode": "DR_INC-ENTITY",
"billingAddress": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/billing-address"
},
"shippingAddress": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-address"
},
"payment": {},
"paymentSession": {
"id": "f3e53825-3d20-4c40-afb8-1cde7bdb3a3b",
"clientSecret": "f3e53825-3d20-4c40-afb8-1cde7bdb3a3b_ef9cb4c1-f56c-4535-bd57-1a313c2f006d",
"status": "requires_source"
},
"shippingMethod": {
"code": 8046100,
"description": "2 business days"
},
"shippingOptions": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-options"
},
"taxInclusive": "false",
"landedCostState": "NOT_ELIGIBLE",
"pricing": {
"subtotal": {
"currency": "USD",
"value": 36
},
"discount": {
"currency": "USD",
"value": 0
},
"shippingAndHandling": {
"currency": "USD",
"value": 50
},
"importTaxAndDuty": {
"currency": "USD",
"value": 0
},
"tax": {
"currency": "USD",
"value": 5.71
},
"orderTotal": {
"currency": "USD",
"value": 91.71
},
"formattedSubtotal": "$36.00",
"formattedDiscount": "$0.00",
"formattedShippingAndHandling": "$50.00",
"formattedImportTaxAndDuty": "$0.00",
"formattedTax": "$5.71",
"formattedOrderTotal": "$91.71"
},
"termsOfSalesAcceptance": null
}
}
The 200 OK
response from the request details on various aspects of the active cart. If the product is a product combination, the combined product information appears under the lineItem
object, and component information appears under the components
object.
The key information in the JSON response from the GET /v1/shoppers/me/carts/active
request includes:
cart: The main object containing all the details about the active shopping cart.
uri: The API endpoint to access the current cart details.
paymentMethods: This object includes the payment information displayed when using a Payment Source created payment.
webCheckout: URL for initiating a web-based checkout.
id: A unique identifier assigned to the cart.
lineItems: This object includes products in the cart, including their details such as name, quantity, and pricing.
totalItemsInCart: The total number of items in the cart.
billingAddress and shippingAddress: These objects include the cart's billing and shipping addresses.
pricing: A summary of the cart's costs, including subtotal, discounts, shipping, taxes, and order total.