Line Items 

A line item represents a single line in a Cart. At a minimum, it contains a single product ID and quantity. Line items can contain offer-level discounts. The Line Items API provides access to products in a cart. Use the Line Items API to get, post, or delete one or more line items from a cart.

Methods


					Host: api.digitalriver.com
User-Agent: API Client/1.0
Accept: application/xml
Authorization: bearer your_access_token
			
					The request body should be empty.
			
					HTTP/1.1 204 No Content
date: Thu, 27 Oct 2016 15:37:06 GMT
x-dr-requestid: dr_request_ID
access-control-allow-origin: *
server: Apache
keep-alive: timeout=5, max=99
x_request_id: TIME=1477582626797:NODE=gcapp01_gcadmsys022002.c022:THREAD=45330
x-server-name: server_name
connection: Keep-Alive
			
					The response body should be empty.
			
					Host: api.digitalriver.com
User-Agent: API Client/1.0
Accept: application/xml
Authorization: bearer your_access_token
			
					The request body should be empty.
			
					HTTP/1.1 204 No Content
date: Thu, 27 Oct 2016 15:37:06 GMT
x-dr-requestid: dr_request_ID
access-control-allow-origin: *
server: Apache
keep-alive: timeout=5, max=99
x_request_id: TIME=1477582626797:NODE=gcapp01_gcadmsys022002.c022:THREAD=45330
x-server-name: server_name
connection: Keep-Alive
			
					The response body should be empty.
			
					Host: api.digitalriver.com
Accept: application/json
Authorization: bearer your_access_token
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_102)
			
					The request body should be empty.
			
					HTTP/1.1 200 OK
			
					{"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/line_item_ID",
      "id": 999999999,
      "quantity": 2,
      "product":       {
         "uri": "https://api.digitalriver.com/v1/shoppers/me/products/product_ID",
         "parentProduct":          {
            "uri": "https://api.digitalriver.com/v1/shoppers/me/products/product_ID",
         },
         "displayName": "Class I",
         "thumbnailImage": "https://drh-sys-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/thumbnail/classIThumb.jpg"
      },
      "pricing":       {
         "listPrice":          {
            "currency": "USD",
            "value": 19.99
         },
         "listPriceWithQuantity":          {
            "currency": "USD",
            "value": 39.98
         },
         "salePriceWithQuantity":          {
            "currency": "USD",
            "value": 35.98
         },
         "formattedListPrice": "$19.99",
         "formattedListPriceWithQuantity": "$39.98",
         "formattedSalePriceWithQuantity": "$35.98"
      }
   }]
}}
			
					Host: api.digitalriver.com
Accept: application/json
Authorization: bearer your_access_token
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_102)
			
					The request body should be empty.
			
					HTTP/1.1 200 OK
			
					<lineItem uri="https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items/99999999999">
      <id>99999999999</id>
      <quantity>1</quantity>
      <product uri="https://api.digitalriver.com/v1/shoppers/me/products/product_ID">
         <displayName>Displayable Product Name A</displayName>
         <thumbnailImage>http://drh1.img.digitalriver.com/DRHM/Storefront/images/product/thumbnail/small-producta-image.jpg</thumbnailImage>
      </product>
      <pricing>
         <listPrice currency="USD">24.95</listPrice>
         <listPriceWithQuantity currency="USD">24.95</listPriceWithQuantity>
         <salePriceWithQuantity currency="USD">24.95</salePriceWithQuantity>
         <formattedListPrice>$24.95</formattedListPrice>
         <formattedListPriceWithQuantity>$24.95</formattedListPriceWithQuantity>
         <formattedSalePriceWithQuantity>$24.95</formattedSalePriceWithQuantity>
      </pricing>
   </lineItem>
			
					Host: api.digitalriver.com
Accept: application/json
Authorization: bearer your_access_token
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_102)
			
					The request body should be empty.
			
					HTTP/1.1 200 OK
			
					{"lineItem": {
   "uri": "https://api.digitalriver.com/v1/shoppers/me/orders/9999999999/line-items/1111111111",
   "id": 1111111111,
   "quantity": 1,
   "product":    {
      "uri": "https://api.digitalriver.com/v1/shoppers/me/products/product_ID",
      "id": product_ID,
      "name": "Class III",
      "displayName": "Class III",
      "shortDescription": "Class III adds the ability to export waypoints, routes, and tracks from your GPS device. With Class II, all GPS data is converted to .shp, .shx, and .dbf files for further use in a GIS environment.",
      "longDescription": "Class III adds the ability to transfer waypoints, routes, and tracks between GPS devices. With Class II, all GPS data can be saved as .shp, .shx, and .dbf files for further use in a GIS environment. In addition, Class III can import shapefiles and convert attributes from the .dbf file into waypoint names and comments. Shapefile import currently supports geometric projection (lat/lon) only.",
      "productType": "DOWNLOAD",
      "sku": "Class III",
      "externalReferenceId": "GPS-XFSD",
      "companyId": "demosft1",
      "displayableProduct": "true",
      "purchasable": "true",
      "manufacturerName": null,
      "manufacturerPartNumber": null,
      "thumbnailImage": "https://domain_ID.digitalriver.com/path/images/product/thumbnail/classIIIThumb_v2.jpg",
      "productImage": "https://domain_ID.digitalriver.com/path/images/product/detail/classIIIBox_v2.jpg",
      "keywords": null,
      "customAttributes": {"attribute":       [
                  {
            "name": "applicationFiles",
            "type": "List",
            "value": "[]"
         },
                  {
            "name": "numberOfDownloads",
            "type": "Integer",
            "value": "5"
         },
                  {
            "name": "gameRating",
            "type": "String",
            "value": "Adults Only"
         },
                  {
            "name": "downloadDisplayName",
            "type": "String",
            "value": "WaterLilies.jpg"
         },
                  {
            "name": "eula",
            "type": "String",
            "value": "Adipiscing, dolore amet magna feugait eum ea, nisl, wisi suscipit lobortis zzril, quis nulla et blandit. Diam dignissim, ex vulputate ullamcorper dolore qui, in, ut. Sit accumsan minim, nulla suscipit magna wisi eros volutpat, vulputate vero eum elit iriure. Ex, iusto duis dolore, ea praesent et vulputate vel ut molestie, lorem tincidunt augue consequat duis vel nulla nostrud exerci, blandit enim duis vero tation in. Facilisis eu in esse molestie nostrud consectetuer suscipit duis at wisi illum nostrud tincidunt vero nulla dolore."
         },
                  {
            "name": "downloadDisplayNames",
            "type": "List",
            "value": "[]"
         },
                  {
            "name": "fileSizes",
            "type": "List",
            "value": "[]"
         },
                  {
            "name": "platform",
            "type": "String",
            "value": "1 User License"
         },
                  {
            "name": "applicationFile",
            "type": "String",
            "value": "WaterLilies.jpg"
         },
                  {
            "name": "numberOfIPAddresses",
            "type": "Integer",
            "value": "10"
         },
                  {
            "name": "systemRequirements",
            "type": "String",
            "value": "Exerci ad nisl commodo esse facilisis consequat in vel laoreet vel tation praesent molestie zzril, ut. At accumsan, ex autem illum volutpat eu veniam enim eu eu, nisl augue suscipit dolore aliquam iusto. Et te dolor ut ad magna tation quis at at augue dolore, aliquip lorem wisi, hendrerit praesent facilisi consectetuer commodo nostrud ut blandit odio et. Eum qui velit odio lobortis vel autem ad consequat lorem praesent facilisis dolore et eros, aliquip aliquip, velit, vel, praesent, ex. Vel, dolor nostrud eu vel delenit et eu qui et commodo dolore consequat ut augue duis."
         },
                  {
            "name": "fileSize",
            "type": "Integer",
            "value": "82"
         },
                  {
            "name": "downloadType",
            "type": "String",
            "value": "HTTP"
         },
                  {
            "name": "downloadAdapter",
            "type": "String",
            "value": "com.digitalriver.downloads.adapters.DRHDownloadAdapter"
         }
      ]}
   },
   "lineItemState": "Complete",
   "lineItemStateDetails":    {
      "description": "Downloadable - 1,Pending Refund - 1",
      "backOrdered": 0,
      "shipped": 0,
      "returned": 0,
      "pendingReturn": 1
   },
   "pricing":    {
      "listPrice":       {
         "currency": "USD",
         "value": 39.99
      },
      "listPriceWithQuantity":       {
         "currency": "USD",
         "value": 39.99
      },
      "salePriceWithQuantity":       {
         "currency": "USD",
         "value": 39.99
      },
      "formattedListPrice": "$39.99",
      "formattedListPriceWithQuantity": "$39.99",
      "formattedSalePriceWithQuantity": "$39.99"
   },
   "downloads": {"downloadUri": ["http://domain_ID.digitalriver.com/path/WaterLilies.jpg"]},
   "digitalRights": {"serialNumber": serial_number}
}}
			
					Host: api.digitalriver.com
Accept: application/json
Authorization: bearer your_access_token
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_102)
			
					The request body should be empty.
			
					HTTP/1.1 200 OK
			
					{"lineItem": {
   "uri": "https://api.digitalriver.com/v1/shoppers/me/orders/9999999999/line-items/1111111111",
   "id": 1111111111,
   "quantity": 1,
   "product":    {
      "uri": "https://api.digitalriver.com/v1/shoppers/me/products/product_ID",
      "id": product_ID,
      "name": "Class III",
      "displayName": "Class III",
      "shortDescription": "Class III adds the ability to export waypoints, routes, and tracks from your GPS device. With Class II, all GPS data is converted to .shp, .shx, and .dbf files for further use in a GIS environment.",
      "longDescription": "Class III adds the ability to transfer waypoints, routes, and tracks between GPS devices. With Class II, all GPS data can be saved as .shp, .shx, and .dbf files for further use in a GIS environment. In addition, Class III can import shapefiles and convert attributes from the .dbf file into waypoint names and comments. Shapefile import currently supports geometric projection (lat/lon) only.",
      "productType": "DOWNLOAD",
      "sku": "Class III",
      "externalReferenceId": "GPS-XFSD",
      "companyId": "demosft1",
      "displayableProduct": "true",
      "purchasable": "true",
      "manufacturerName": null,
      "manufacturerPartNumber": null,
      "thumbnailImage": "https://domain_ID.digitalriver.com/path/images/product/thumbnail/classIIIThumb_v2.jpg",
      "productImage": "https://domain_ID.digitalriver.com/path/images/product/detail/classIIIBox_v2.jpg",
      "keywords": null,
      "customAttributes": {"attribute":       [
                  {
            "name": "applicationFiles",
            "type": "List",
            "value": "[]"
         },
                  {
            "name": "numberOfDownloads",
            "type": "Integer",
            "value": "5"
         },
                  {
            "name": "gameRating",
            "type": "String",
            "value": "Adults Only"
         },
                  {
            "name": "downloadDisplayName",
            "type": "String",
            "value": "WaterLilies.jpg"
         },
                  {
            "name": "eula",
            "type": "String",
            "value": "Adipiscing, dolore amet magna feugait eum ea, nisl, wisi suscipit lobortis zzril, quis nulla et blandit. Diam dignissim, ex vulputate ullamcorper dolore qui, in, ut. Sit accumsan minim, nulla suscipit magna wisi eros volutpat, vulputate vero eum elit iriure. Ex, iusto duis dolore, ea praesent et vulputate vel ut molestie, lorem tincidunt augue consequat duis vel nulla nostrud exerci, blandit enim duis vero tation in. Facilisis eu in esse molestie nostrud consectetuer suscipit duis at wisi illum nostrud tincidunt vero nulla dolore."
         },
                  {
            "name": "downloadDisplayNames",
            "type": "List",
            "value": "[]"
         },
                  {
            "name": "fileSizes",
            "type": "List",
            "value": "[]"
         },
                  {
            "name": "platform",
            "type": "String",
            "value": "1 User License"
         },
                  {
            "name": "applicationFile",
            "type": "String",
            "value": "WaterLilies.jpg"
         },
                  {
            "name": "numberOfIPAddresses",
            "type": "Integer",
            "value": "10"
         },
                  {
            "name": "systemRequirements",
            "type": "String",
            "value": "Exerci ad nisl commodo esse facilisis consequat in vel laoreet vel tation praesent molestie zzril, ut. At accumsan, ex autem illum volutpat eu veniam enim eu eu, nisl augue suscipit dolore aliquam iusto. Et te dolor ut ad magna tation quis at at augue dolore, aliquip lorem wisi, hendrerit praesent facilisi consectetuer commodo nostrud ut blandit odio et. Eum qui velit odio lobortis vel autem ad consequat lorem praesent facilisis dolore et eros, aliquip aliquip, velit, vel, praesent, ex. Vel, dolor nostrud eu vel delenit et eu qui et commodo dolore consequat ut augue duis."
         },
                  {
            "name": "fileSize",
            "type": "Integer",
            "value": "82"
         },
                  {
            "name": "downloadType",
            "type": "String",
            "value": "HTTP"
         },
                  {
            "name": "downloadAdapter",
            "type": "String",
            "value": "com.digitalriver.downloads.adapters.DRHDownloadAdapter"
         }
      ]}
   },
   "lineItemState": "Complete",
   "lineItemStateDetails":    {
      "description": "Downloadable - 1,Pending Refund - 1",
      "backOrdered": 0,
      "shipped": 0,
      "returned": 0,
      "pendingReturn": 1
   },
   "pricing":    {
      "listPrice":       {
         "currency": "USD",
         "value": 39.99
      },
      "listPriceWithQuantity":       {
         "currency": "USD",
         "value": 39.99
      },
      "salePriceWithQuantity":       {
         "currency": "USD",
         "value": 39.99
      },
      "formattedListPrice": "$39.99",
      "formattedListPriceWithQuantity": "$39.99",
      "formattedSalePriceWithQuantity": "$39.99"
   },
   "downloads": {"downloadUri": ["http://domain_ID.digitalriver.com/path/WaterLilies.jpg"]},
   "digitalRights": {"serialNumber": serial_number}
}}
			
					Host: api.digitalriver.com
User-Agent: API Client/1.0
Accept: application/xml
Authorization: bearer your_access_token
			
					The request body should be empty.
			
					HTTP/1.1 201 Created
Content-Length: 0
Location: https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items/999999999
			
					The response body should be empty.
			


					Host: api.digitalriver.com
User-Agent: API Client/1.0
Accept: application/xml
Authorization: bearer your_access_token
			
					The request body should be empty.
			
					HTTP/1.1 200 OK
			
					<lineItem uri="https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items/99999999999">
      <id>99999999999</id>
      <quantity>3</quantity>
      <product uri="https://api.digitalriver.com/v1/shoppers/me/products/product_ID">
         <displayName>Displayable Product Name A</displayName>
         <thumbnailImage>http://drh1.img.digitalriver.com/DRHM/Storefront/images/product/thumbnail/small-producta-image.jpg</thumbnailImage>
      </product>
      <pricing>
         <listPrice currency="USD">4.95</listPrice>
         <listPriceWithQuantity currency="USD">14.85</listPriceWithQuantity>
         <salePriceWithQuantity currency="USD">14.85</salePriceWithQuantity>
         <formattedListPrice>$4.95</formattedListPrice>
         <formattedListPriceWithQuantity>$14.85</formattedListPriceWithQuantity>
         <formattedSalePriceWithQuantity>$14.85</formattedSalePriceWithQuantity>
      </pricing>
   </lineItem>
			

Response Body Parameters

Fields
Data Type
Visibility
Description
digitalRights
structured
default
Digital rights manage the serial numbers and unlock codes that control shopper access to purchased software and other digital products.
downloads
structured
default
Contains the download information for the line item.
id
string
default
The line item ID. The ID is assigned automatically when the line item is created
lineItemState
string
default
The status of the line item.
lineItemStateDetails
structured
default
The status details for the line item.
lineItemStateDetails.backOrdered
integer
default
The number of items on back order.
lineItemStateDetails.description
string
default
A description of the line item state.
lineItemStateDetails.pendingReturn
integer
default
The number of items pending return.
lineItemStateDetails.returned
integer
default
The number of items returned.
lineItemStateDetails.shipped
integer
default
The number of items shipped.
pricing
structured
expand
The pricing information for the line item. See the Pricing API for more information.
product
resource
default
The product for the line item. See the Products API for more information
quantity
int
default
The number of products in a line item.

Action Query Parameter for the Line Items API

The line-items post behavior and its impact on a cart are as follows for each value of the action query parameter:

Query
Description
action=add
If a line-item with the specified ID does not exist in the cart, a post to the Line Items API with the add action creates a line item and adds the product to the cart.
If a line item already exists in the cart, a post to the Line Items API with the add action updates an existing item by adding the posted quantity value to the existing quantity.
Typical usage applies additional quantities of products to the cart. Using the add action with a quantity less than zero subtracts from an existing quantity. Adding a product that does not exist with zero or a negative quantity is a non-operation. This behavior may change to return an error.
action=update
If a line item with the specified ID does not exist in the cart, a post to the Line Items API with the update action creates a line item and adds the product to the cart.
For existing line items, a post to the Line Items API with the update action explicitly updates the quantity of an existing line item, setting the quantities of existing products.
action=subtract
A post to the Line Items API with the subtract action decrements the quantity of an existing line item. Specifying an action of subtracting for an item that does not exist is a non-operation. This behavior may change to return an error.