Adding a product to a cart
Learn how to add a product to a cart.
Add a product to a cart using the product identifier
Send a POST /v1/shoppers/me/carts/active
request to add a product to a cart, provide the product identifier (productId
). If you want to add a product combination to the cart, use the product identifier for the product combination. If the product is a product combination, the combined product information appears under the lineItem
object, and component information appears under the component
object.
curl --location --request POST 'https://api.digitalriver.com/v1/shoppers/me/carts/active?productId={productId}' \
--header 'authorization: Basic ***\
...
A successful request returns a 200 OK
response.
{
"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.com/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
}
}
See Update current cart query parameters for more information.
Last updated