Adding a product to a cart
Learn how to add a product to a cart.
Send a
POST /v1/shoppers/me/carts/active
request to add a product to a cart, provide the product identifier (productId
) .cURL
200 OK response
curl --location --request POST 'https://api.digitalriver.com/v1/shoppers/me/carts/active?productId={pid}' \
--header 'authorization: Basic ***\
...
A successful request returns a
200 OK
response.{
"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"
}
}
Last modified 1mo ago