Cart

The Carts resource provides access to a customer's cart and cart data. Use the Cart resource to get, update, or modify a cart.

Important: All methods in this API requires an anonymous (limited access) or authenticated (full access) token.

Example shopping cart

Creating a cart

Use the GET /shoppers/token resource to create an anonymous (limited access) or authenticated (full access) token. The response to this request creates a shopping cart and returns an access token to be included in all other cart interactions.

URI
Request header
Request body
Response header
Response body
URI
GET shoppers/me/carts/active
Request header
Host: api.digitalriver.com
Accept: application/json
Authorization: bearer your_access_token
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_102)
Request body
The request body should be empty.
Response header
HTTP/1.1 200 OK
Response body
{
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active",
"paymentMethods": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/payment-methods"
},
"applyPaymentMethod": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/apply-payment-method"
},
"submitCart": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/submit-cart"
},
"webCheckout": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/web-checkout"
},
"id": "47278010023",
"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/488822300023",
"id": "488822300023",
"quantity": "1",
"product": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/products/64578500",
"parentProduct": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/products/64358200"
},
"id": "64578500",
"name": "Class I",
"displayName": "Class I",
"shortDescription": "Class I is the perfect GPS waypoint and route manager for the beginning or occasional GPS user.",
"longDescription": "Class I is the fast and easy way to create, edit, and transfer waypoints and routes between your computer and your Garmin, Magellan, or Lowrance GPS. Using Class I, you can manage all of your waypoints and routes, and display them in lists sorted by name, elevation, or distance. Class I connects your GPS to the best mapping and information sites on the Internet, giving you one-click access to street and topo maps, aerial photos, weather forecasts, and nearby attractions.",
"productType": "DOWNLOAD",
"sku": "Class I",
"externalReferenceId": "Test External Reference Number",
"companyId": "demosft1",
"displayableProduct": "true",
"purchasable": "true",
"manufacturerName": "Test Manufacturer Name",
"manufacturerPartNumber": "Test Manufacturer Part Number",
"thumbnailImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/thumbnail/classIThumb.jpg",
"productImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/detail/classIBox.jpg",
"keywords": "testKeyword",
"customAttributes": {
"attribute": [
{
"name": "name",
"value": "string",
"type": "string"
}
]
}
},
"pricing": {
"listPrice": {
"currency": "USD",
"value": "19.99"
},
"listPriceWithQuantity": {
"currency": "USD",
"value": "19.99"
},
"salePriceWithQuantity": {
"currency": "USD",
"value": "19.99"
},
"formattedListPrice": "$19.99",
"formattedListPriceWithQuantity": "$19.99",
"formattedSalePriceWithQuantity": "$17.99",
"formattedCommitmentPrice": "$240.00",
"commitmentPrice": {
"currency": "USD",
"value": 240.00
},
"tax": {
"currency": "USD",
"value": 2.00
},
"taxRate": 0.1111
}
}
},
"totalItemsInCart": "1",
"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": {
"name": "Discover",
"displayableNumber": "************4321",
"expirationMonth": "01",
"expirationYear": "2020"
},
"shippingOptions": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-options"
},
"pricing": {
"subtotal": {
"currency": "USD",
"value": "19.99"
},
"discount": {
"currency": "USD",
"value": "19.99"
},
"shippingAndHandling": {
"currency": "USD",
"value": "19.99"
},
"tax": {
"currency": "USD",
"value": "19.99"
},
"orderTotal": {
"currency": "USD",
"value": "19.99"
},
"formattedSubtotal": "$17.99",
"formattedDiscount": "$5.00",
"formattedShippingAndHandling": "$0.00",
"formattedTax": "$0.96",
"formattedOrderTotal": "$13.95"
}
}

Updating a cart

Use the POST /shoppers/me/carts/active resource to add products, coupon codes, billing/shipping address, and offers to a customer's cart.

All of the resources contained in the Cart can be leveraged to modify specific cart data elements.

Required: A level 3 API key, a legal/contract amendment, and PCI documentation are required to pass customer credit card information through the Cart resource. Please reach out to your Account Manager if you are interested in this capability.

For example, to add a product to a cart:

URI
Request header
Request body
Response header
Response body
URI
POST /shoppers/me/carts/active?productId=pid&termId=termId
Request header
Host: api.digitalriver.com
Accept: application/json
Authorization: bearer your_access_token
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_102)
Request body
The request body should be empty.
Response header
HTTP/1.1 200 OK
Response body
{
"cart": {
"id": "13871346482",
"webCheckout": {
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/web-checkout"
},
"lineItems": {
"lineItem": {
"id": "line_item_ID",
"quantity": "1",
"product": {
"displayName": "Network Pro",
"thumbnailImage": "http://.../Storefront/Company/aqued/images/product/thumbnail/80x80net.png",
"_uri": "https://api.digitalriver.com/v1/shoppers/me/products/product_ID"
},
"pricing": {
"listPrice": {
"_currency": "USD",
"__text": "2.00"
},
"listPriceWithQuantity": {
"_currency": "USD",
"__text": "2.00"
},
"salePriceWithQuantity": {
"_currency": "USD",
"__text": "1.80"
},
"formattedListPrice": "$2.00",
"formattedListPriceWithQuantity": "$2.00",
"formattedSalePriceWithQuantity": "$1.80"
},
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items/line_item_ID"
},
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items"
},
"totalItemsInCart": "1",
"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": "",
"shippingMethod": "",
"shippingOptions": {
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-options"
},
"pricing": {
"subtotal": {
"_currency": "USD",
"__text": "1.80"
},
"discount": {
"_currency": "USD",
"__text": "0.18"
},
"shippingAndHandling": {
"_currency": "USD",
"__text": "0.00"
},
"tax": {
"_currency": "USD",
"__text": "0.00"
},
"orderTotal": {
"_currency": "USD",
"__text": "1.62"
},
"formattedSubtotal": "$1.80",
"formattedDiscount": "$0.18",
"formattedShippingAndHandling": "$0.00",
"formattedTax": "$0.00",
"formattedOrderTotal": "$1.62"
},
"tax": {
"currency": "USD",
"value": 2.00
},
"taxRate": 0.1111
"_uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active"
}
}

Redirecting to a Digital River-hosted cart

To overcome the PCI liability, you can use the GET /shoppers/me/carts/active/web-checkout resource to transfer a customer to your Digital River-hosted checkout pages. This endpoint returns a 302 redirect with the location of the appropriate location of the shopping cart.

Required: A session aware token is required to ensure continuity between the API cart and the Digital River-hosted checkout.

Upon successful redirection, the customer will complete their order on your Digital River-hosted checkout pages.

Submit a cart

Use the Submit Cart resource to submit a cart. A cart cannot be submitted until the following items have been added or applied to the cart:

  • One or more products

  • Shipping option (if the product is a physical product)

  • Shipping address

  • Billing address

  • Payment option

Submitting a cart creates the order and builds a Thank You page. If the customer purchased a digital product, the cart presents the download links to the customer. If the customer selects a check as the payment type, the cart provides delayed payment instructions. If the customer chooses a payment service provider as the payment type, the cart provides links to the payment provider such as PayPal.

URI
Request header
Request body
Response header
Response body
URI
POST shoppers/me/carts/active/submit-cart
Request header
Host: api.digitalriver.com
Accept: application/json
Authorization: bearer your_access_token
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_102)
Request body
The request body should be empty.
Response header
HTTP/1.1 200 OK
Response body
{
"order": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/orders/47278080023",
"id": "47278080023",
"submissionDate": "2018-04-27T20:31:13.109Z",
"displayName": "New Order",
"locale": "en_US",
"optIn": "false",
"testOrder": "false",
"taxExempt": "false",
"businessEntityCode": "DR_INC-ENTITY",
"orderState": "Submitted",
"orderStateDetails": {
"description": "Settled",
"settled": {
"currency": "USD",
"value": "19.99"
},
"refunded": {
"currency": "USD",
"value": "19.99"
}
},
"customAttributes": {
"attribute": [
{
"name": "name",
"value": "string",
"type": "string"
}
]
}
},
"lineItems": {
"lineItem": {
"id": "488822390023",
"quantity": "1",
"product": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/products/64578500",
"parentProduct": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/products/64358200"
},
"id": "64578500",
"name": "Class I",
"displayName": "Class I",
"shortDescription": "Class I is the perfect GPS waypoint and route manager for the beginning or occasional GPS user.",
"longDescription": "Class I is the fast and easy way to create, edit, and transfer waypoints and routes between your computer and your Garmin, Magellan, or Lowrance GPS. Using Class I, you can manage all of your waypoints and routes, and display them in lists sorted by name, elevation, or distance. Class I connects your GPS to the best mapping and information sites on the Internet, giving you one-click access to street and topo maps, aerial photos, weather forecasts, and nearby attractions.",
"productType": "DOWNLOAD",
"sku": "Class I",
"externalReferenceId": "Test External Reference Number",
"companyId": "demosft1",
"displayableProduct": "true",
"purchasable": "true",
"manufacturerName": "Test Manufacturer Name",
"manufacturerPartNumber": "Test Manufacturer Part Number",
"thumbnailImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/thumbnail/classIThumb.jpg",
"productImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/detail/classIBox.jpg",
"keywords": "testKeyword",
"customAttributes": {
"attribute": [
{
"name": "name",
"value": "string",
"type": "string"
}
]
}
},
"lineItemState": "Downloadable",
"lineItemStateDetails": {
"description": "Downloadable - 1",
"backOrdered": "0",
"shipped": "0",
"returned": "0",
"pendingReturn": "0"
},
"pricing": {
"listPrice": {
"currency": "USD",
"value": "19.99"
},
"listPriceWithQuantity": {
"currency": "USD",
"value": "19.99"
},
"salePrice": {
"currency": "USD",
"value": "19.99"
},
"salePriceWithQuantity": {
"currency": "USD",
"value": "19.99"
},
"formattedListPrice": "$0.00",
"formattedListPriceWithQuantity": "$0.00",
"formattedSalePrice": "$0.00",
"formattedSalePriceWithQuantity": "$0.00",
"totalDiscountWithQuantity": {
"currency": "USD",
"value": "19.99"
},
"formattedTotalDiscountWithQuantity": "$0.00",
"discountDescription": "string",
"formattedCommitmentPrice": "$240.00",
"commitmentPrice": {
"currency": "USD",
"value": "240.00"
}
"tax": {
"currency": "USD",
"value": 2.00
},
"taxRate": 0.1111
},
"downloads": {
"downloadUri": "http://wgtintot12.digitalriver.com/wgt/9B5A4FCEF11DA80C/171F14235882A3D3E56B5723F9D46513279A35381E6ECCFA38DC305C96D769173E906E98A04A2B5B3CFFB85C93D810E7B365B18617EBAE4682F5E46FAD1C55CE291C52E8142F3D624C7461A8833978160451C577DBEF2976/demosft1/WaterLilies.jpg"
},
"customAttributes": {
"attribute": [
{
"name": "name",
"value": "string",
"type": "string"
}
]
}
}
},
"billingAddress": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/address/47278020023",
"id": "billingAddress",
"firstName": "Automation",
"lastName": "Tester",
"line1": "PO BOX 6930",
"line2": "123",
"line3": "Suite Line 3",
"city": "Waconia",
"countrySubdivision": "MN",
"postalCode": 5387,
"country": "US",
"countryName": "United States",
"phoneNumber": "099-222-44454",
"emailAddress": "automatedTester68091904@digitalriver.com"
},
"shippingAddress": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/address/47278020023",
"id": "billingAddress",
"firstName": "Automation",
"lastName": "Tester",
"line1": "PO BOX 6930",
"line2": "123",
"line3": "Suite Line 3",
"city": "Waconia",
"countrySubdivision": "MN",
"postalCode": 5387,
"country": "US",
"countryName": "United States",
"phoneNumber": "099-222-44454",
"emailAddress": "automatedTester68091904@digitalriver.com"
},
"pricing": {
"subtotal": {
"currency": "USD",
"value": "19.99"
},
"subtotalWithDiscount": {
"currency": "USD",
"value": "19.99"
},
"discount": {
"currency": "USD",
"value": "19.99"
},
"shippingAndHandling": {
"currency": "USD",
"value": "19.99"
},
"tax": {
"currency": "USD",
"value": "19.99"
},
"orderTotal": {
"currency": "USD",
"value": "19.99"
},
"formattedSubtotal": "$0.00",
"formattedSubtotalWithDiscount": "$0.00",
"formattedDiscount": "$0.00",
"formattedShippingAndHandling": "$0.00",
"formattedTax": "$0.00",
"formattedOrderTotal": "$0.00"
},
"payment": {}
}

Get line items from a cart

You can Line Items resource to get all line items, including products, pricing, and tax information from a cart.

URI
Request header
Request body
Response header
Response body
URI
GET /v1/shoppers/me/carts/active/line-items
Request header
Host: api.digitalriver.com
Accept: application/json
Authorization: bearer your_access_token
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_102)
Request body
The request body should be empty.
Response header
HTTP/1.1 200 OK
Response body
{
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active",
"paymentMethods": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/payment-methods"
},
"applyPaymentMethod": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/apply-payment-method"
},
"submitCart": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/submit-cart"
},
"webCheckout": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/web-checkout"
},
"id": "47278010023",
"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/488822300023",
"id": "488822300023",
"quantity": "1",
"product": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/products/64578500",
"parentProduct": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/products/64358200"
},
"id": "64578500",
"name": "Class I",
"displayName": "Class I",
"shortDescription": "Class I is the perfect GPS waypoint and route manager for the beginning or occasional GPS user.",
"longDescription": "Class I is the fast and easy way to create, edit, and transfer waypoints and routes between your computer and your Garmin, Magellan, or Lowrance GPS. Using Class I, you can manage all of your waypoints and routes, and display them in lists sorted by name, elevation, or distance. Class I connects your GPS to the best mapping and information sites on the Internet, giving you one-click access to street and topo maps, aerial photos, weather forecasts, and nearby attractions.",
"productType": "DOWNLOAD",
"sku": "Class I",
"externalReferenceId": "Test External Reference Number",
"companyId": "demosft1",
"displayableProduct": "true",
"purchasable": "true",
"manufacturerName": "Test Manufacturer Name",
"manufacturerPartNumber": "Test Manufacturer Part Number",
"thumbnailImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/thumbnail/classIThumb.jpg",
"productImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/detail/classIBox.jpg",
"keywords": "testKeyword",
"customAttributes": {
"attribute": [
{
"name": "name",
"value": "string",
"type": "string"
}
]
}
},
"pricing": {
"listPrice": {
"currency": "USD",
"value": "19.99"
},
"listPriceWithQuantity": {
"currency": "USD",
"value": "19.99"
},
"salePriceWithQuantity": {
"currency": "USD",
"value": "19.99"
},
"formattedListPrice": "$19.99",
"formattedListPriceWithQuantity": "$19.99",
"formattedSalePriceWithQuantity": "$17.99",
"formattedCommitmentPrice": "$240.00",
"commitmentPrice": {
"currency": "USD",
"value": 240.00
},
"tax": {
"currency": "USD",
"value": 2.00
},
"taxRate": 0.1111
}
}
},
"totalItemsInCart": "1",
"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": {
"name": "Discover",
"displayableNumber": "************4321",
"expirationMonth": "01",
"expirationYear": "2020"
},
"shippingOptions": {
"uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-options"
},
"pricing": {
"subtotal": {
"currency": "USD",
"value": "19.99"
},
"discount": {
"currency": "USD",
"value": "19.99"
},
"shippingAndHandling": {
"currency": "USD",
"value": "19.99"
},
"tax": {
"currency": "USD",
"value": "19.99"
},
"orderTotal": {
"currency": "USD",
"value": "19.99"
},
"formattedSubtotal": "$17.99",
"formattedDiscount": "$5.00",
"formattedShippingAndHandling": "$0.00",
"formattedTax": "$0.96",
"formattedOrderTotal": "$13.95"
}
}

Line item

The lineItems in the cart's response body provide the details of a physical or digital product including, quantity, product, product ID, pricing.

Product

A product provides the details of a physical or digital product.

Pricing

The pricing defines the pricing for the item and provides the tax information. Digital River provides the tax rate (taxRate) information and the amount (tax) at the line item level.

Tax

Digital River automatically calculates the tax rate. The taxRate requires a decimal value. For example, if the calculated tax rate is 19%, the value is .19, as shown in the following example.

Example
Example
"tax": {
"currency": "EUR",
"value": 6.93
},
"taxRate": 0.19