Describing line items

Understand how to describe a checkout's products or services

You use a checkout's items[] array to pass data on products and/or services in a customer's cart. The elements of items[] allow you to:

After you create a checkout, we return an items[].id that uniquely identifies each of a checkout's line items. This identifier is needed to modify the line item in a update checkout requests.

Since update checkout requests only allow you to modify subscription, ship from and meta data, your create checkout request must include a line item's product data, price, and quantity.

For more information, refer to the sending the create checkout request section on the Building checkouts page.

Sending product data in checkouts

In create checkout requests, you must provide Digital River both basic and compliance data on the products in a customer's cart. You have three options for passing this data. You can:

Whichever option you select, Digital River always returns productDetails.

Digital River also assigns each of a checkout's items[] a unique id.

Send basic and compliance data in SKUs

In this option, prior to checking out customers, you must define and create a SKU for each of the product's in your catalog. Each SKU needs to contain both basic and compliance data on that product.

For more information, refer to the Product basics and Managing SKUs pages.

In this option, each items[] in a POST/checkouts must contain a skuId.

POST/checkouts
curl --location --request POST 'https://api.digitalriver.com/checkouts' \
...
--data-raw '{
    ...
    "items": [
        {
            "skuId": "d0c6c536-1a5b-4c1d-be86-92e3363a1e1f",
            "quantity": 2,
            "price": 10
        }
    ]
}'

Once you submit this request, Digital River retrieves all the product data that we need from the referenced SKU.

This option requires you to keep the product catalog in your system synchronized with your SKUs in our system.

Send basic data in SKUs and compliance data in SKU groups

In this option, prior to checking out customers, you must define and create a SKU for each of the product's in your catalog. The SKUs only need to contain basic product data.

Before creating checkouts, you must also associate a SKU group with each of your SKUs by setting the SKU's skuGroupId. The SKU group holds the product's compliance data.

For more information, refer to:

In this option, each items[] in a POST/checkouts must contain a skuId.

POST/checkouts
curl --location --request POST 'https://api.digitalriver.com/checkouts' \
...
--data-raw '{
    ...
    "items": [
        {
            "skuId": "d0c6c536-1a5b-4c1d-be86-92e3363a1e1f",
            "quantity": 2,
            "price": 10
        }
    ]
}'

Once you submit this request, Digital River retrieves basic product data from the referenced SKU and compliance product data from the SKU's SKU group.

This option requires that you keep the product catalog in your system synchronized with your SKUs in our system.

Common attributes and data priority in SKUs and SKU groups

If you decide to use this option, you should be aware that the following attributes are common to both SKUs and SKU groups:

  • Harmonized system code

  • Export control classification number

  • Tax code

In checkouts, a SKU group's data takes precedence over a SKU's data. If a common attribute is defined in a SKU, but not the SKU group it belongs to, then we use the SKU's data in the checkout.

For more details, refer to Migrating to SKU groups on the Grouping SKUs page.

Send basic data in product details and compliance data in SKU groups

In this option, you don't store basic product data in Digital River's system.

Instead, you retrieve this data from your system and, for each items[] in a POST/checkouts, use it to define productDetails .

The id in productDetails should be the same as the identifier of the product in your system.

The productDetails object must also contain a skuGroupId that references the SKU group that holds the product's compliance data.

Digital River then accesses basic product data from productDetails and compliance data from the referenced SKU group.

POST/checkouts
curl --location --request POST 'https://api.digitalriver.com/checkouts' \
...
--data-raw '{
    ...
    "items": [
        {
            "productDetails": {
                "id": "2837a981-9e41-408b-a1b2-ffa3223bc505",
                "skuGroupId": "wireless-keyboards",
                "name": "Basic wireless keyboard",
                "description": "A simple, basic wireless keyboard",
                "url": "https://www.company.com/basic-wireless-keyboard",
                "countryOfOrigin": "US",
                "image": "https://www.company.com/basic-wireless-keyboard/image",
                "weight": 1,
                "weightUnit": "kg",
                "partNumber": "ce1fd95d-b211-47e8-a9b7-9941a4ce9d7a"
            }
            "quantity": 2,
            "price": 10
        }
    ]
}'

Since you're not persisting any basic product data in Digital River's system, you're not required to keep the product catalog in your system synchronized with SKUs in our system.

Prior to deployment however you do need to work with Digital River to define your SKU groups. Once defined, Digital River is responsible for managing the data in this resource.

For more information, refer to the Grouping SKUs page.

Common attributes in productDetails and SKUs

If your integration currently uses SKUs, and you're considering a migration to this option, you should be aware that the attributes in SKUs and productDetails are nearly identical.

The key exceptions are taxCode, eccn, and hsCode. These attributes exist in SKUs but not in productDetails. This is because all of these attributes contain compliance data which is saved in the associated SKU group.

SKUs also have a manufacturerId and this attribute is not in productDetails.

In Digital River coordinated fulfillments, manufacturerId is used to set up products in warehouses. That process however is handled prior to deployment. So there's no need to set manufacturerId in checkouts.

How Digital River returns product data

Whether you send productDetails or skuId in POST/ checkouts, the 201 Created response always contains productDetails.

If you pass productDetails, we give you back that same data.

But if your integration sends skuId, Digital River retrieves basic product data from the referenced SKU (along with that object's identifier), and uses it to populate the checkout's productDetails. If you convert the checkout to an order, productDetails is also passed through to that object.

curl --location --request POST 'https://api.digitalriver.com/checkouts' \
...
--data-raw '{
    ...
    "items": [
        {
            "skuId": "b0fd7334-8f7d-424e-b535-308fae972461",
            "quantity": 2,
            "price": 10
        }
    ],
    ...
}'

As a result, in both checkouts and orders, as well as their associated events, such as checkout.updated, order.complete, and subscription.reminder, you can easily access product data without having to make another call to retrieve the SKU.

This feature is especially useful if you employ a third-party service that sends emails and other notifications to customers. These services can configure a webhook to listen for events such as order.fulfilled , order.cancelled, and order.complete, and then handle these events by retrieving data from productDetails and passing it in the notification.

Setting price and quantity

For each element in a checkout's items[] array, you must specify quantity. This represents the number of items selected by the customer. If you don't specify quantity, then its value defaults to 1.

You must also set the line item's price or aggregatePrice.

For more information on how to do this, refer to the Setting the price of an item page.

Providing subscription information

In checkouts, you set subscriptionInfo at the line-item level. For more information, refer to:

Discounting a product

For each element in a checkout's items[] array, you can set a product-level discount.

For more information, refer to the product discounts section on the Applying a discount page.

Setting a ship from location

If a checkout's products are shipping from multiple locations, you can specify each location using items[].shipFrom.

For more information, refer to the ship from address section on the Providing address information page.

Updating items

When updating products or services in a POST/checkouts/{id} request, you need to provide the line item identifier returned in the checkout.

For each line item in the update checkout request, you're restricted to updating subscription information, a product's ship from address, and metadata.

If you attempt to update any other line item data, you receive a 400 Bad Request:

{
    "type": "bad_request",
    "errors": [
        {
            "code": "unknown_parameter",
            "parameter": "price",
            "message": "'price' is an unknown parameter."
        }
    ]
}

Last updated