# Products

A product (a stock keeping unit or SKU) is a sellable item or service. Products in your Digital River catalog contain all the required attributes to complete an end-consumer transaction (payments, tax, and fulfillment). You can generally configure the product in one of two ways:

* An [individual product](#individual-product) (single sellable SKU)
* A [base product](#base-product) with [product variations](#product-variations) (base product with multiple sellable SKU variants)

You can retrieve the catalog product information, including applicable discounted prices, by leveraging the available product endpoints.

## Individual product

An individual product is a single item, such as a downloadable song, or a collection of items, such as a box set. Use the `POST /v1/products` request to [create an individual product](https://app.gitbook.com/s/-LzlYMEYC0GeLSgnsft6/admin-apis/product-management/manage-products-asynchronous-api/creating-or-updating-a-product) and the `POST /products/{productId}` request to [update an individual product](https://app.gitbook.com/s/-LzlYMEYC0GeLSgnsft6/admin-apis/product-management/manage-products-asynchronous-api/creating-or-updating-a-product). There are no [product variations](#product-variations) associated with it.

{% hint style="info" %}
To [convert an individual product to a base product or a base product to an individual product](https://help.digitalriver.com/help/gc/Products/All-Products/Editing-a-product.htm#AddingRemovingVariations), use [Global Commerce](https://gc.digitalriver.com/gc/ent/login.do).
{% endhint %}

An individual product is a single sellable stock keeping unit (SKU). The following image shows an example of a SKU:

<div align="left"><figure><img src="https://2614884072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoUderMtztdH7OKDXmYbI%2Fuploads%2F7CUMy2Q4RkcByKsojAos%2Fimage.png?alt=media&#x26;token=d943c64d-2484-419b-9b8b-d7f0e6789aa5" alt=""><figcaption></figcaption></figure></div>

## Base product

&#x20;If a product comes in different colors, sizes, or versions, it is easier to maintain a base product with [product variations ](#product-variations)than a handful of nearly identical products.

You can [create a base product](https://app.gitbook.com/s/-LzlYMEYC0GeLSgnsft6/admin-apis/product-management/manage-products-asynchronous-api/creating-or-updating-a-product#creating-an-individual-or-base-product) (parent) that contains the common attributes for all product variations (children) of that product. All product variations inherit common attributes. For example, if two variations of a base product require the same product images, add those images to the base product before creating your variations.

{% hint style="info" %}
**Note**: A shopper cannot add a base product to a cart. They can only add the [product variation](#product-variations) to the cart. For example, a shopper can go to the Digital River-hosted storefront and choose a product variation from an interstitial page. The store template automates and controls this behavior.
{% endhint %}

Use the `POST /v1/products` request to [create a base product](https://app.gitbook.com/s/-LzlYMEYC0GeLSgnsft6/admin-apis/product-management/manage-products-asynchronous-api/creating-or-updating-a-product#creating-an-individual-or-base-product) and the `POST /v1/products/{productId}` request to [update a base product](https://app.gitbook.com/s/-LzlYMEYC0GeLSgnsft6/admin-apis/product-management/manage-products-asynchronous-api/creating-or-updating-a-product).&#x20;

## Product variations

Product variations are different versions of a base product that a shopper can purchase, such as different versions, sizes, or capacities. When you [add a product variation](https://app.gitbook.com/s/-LzlYMEYC0GeLSgnsft6/admin-apis/product-management/manage-products-asynchronous-api/adding-or-updating-a-product-variation), the request copies the common attributes from the base product to the variation. You must change the appropriate attributes and settings to make that variation unique. Each product variation contains attributes and settings that are unique to that product variation.&#x20;

You must change at least one common attribute to make the product variation unique. Only change those settings or attributes that are unique to the variation to reduce operational maintenance.

The following image shows an example of a product variant on a store's website:

<div align="left"><figure><img src="https://2614884072-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoUderMtztdH7OKDXmYbI%2Fuploads%2Fk0F0Lo8B0afgJWaav1VW%2Fimage.png?alt=media&#x26;token=71b2ed34-121a-452b-bc93-947479d43496" alt=""><figcaption></figcaption></figure></div>

## Creating a base product with variations

You can choose to either:

* [Create a base product first and add the product variations later](#create-the-base-product-first)
* [Create the base products and product variations in one call](#create-the-base-product-and-product-variations-simultaneously)

### Create the base product first

[Create the base product](https://app.gitbook.com/s/-LzlYMEYC0GeLSgnsft6/admin-apis/product-management/manage-products-asynchronous-api/creating-or-updating-a-product#creating-an-individual-or-base-product) first and include the common attributes. If you choose not to define some of the common attributes, those attributes will not be available when you [add a product variation](https://app.gitbook.com/s/-LzlYMEYC0GeLSgnsft6/admin-apis/product-management/manage-products-asynchronous-api/adding-or-updating-a-product-variation#adding-a-product-variation-to-a-base-product).

{% hint style="success" %}
Define as many common attributes as possible for the base product before you create a product variation.
{% endhint %}

You can add the product variations to that base product later.

### Create the base product and product variations simultaneously

You can [create a base product and all its product variations](https://app.gitbook.com/s/-LzlYMEYC0GeLSgnsft6/admin-apis/product-management/manage-products-asynchronous-api/creating-or-updating-a-product#creating-an-individual-or-base-product) using one call by adding the `variations` object to the payload. The request copies the common attributes from the base product to each product variation. You modify the attributes for each product variation in the payload when you [update the product variation](https://app.gitbook.com/s/-LzlYMEYC0GeLSgnsft6/admin-apis/product-management/manage-products-asynchronous-api/adding-or-updating-a-product-variation#updating-a-specific-product-variation).&#x20;

{% tabs %}
{% tab title="cURL example 1" %}
The following example adds or updates a base product and its product variations.

```http
curl --location --request POST 'https://api.digitalriver.com/v1/products' \
--header 'Authorization: Bearer <API_key>' \
...
--data-raw '{
    "companyId":"digitalriver",
    "deploymentRequiredChanges": {
        "fulfillmentTypes": ["Download","Physical"]
    },
    "liveChanges": {
        "externalId": "external-reference-id-{{uuid}}",
        "catalogs" : [ {
            "catalogId" : "4783669800",
            "pricing" : [ {
                "type": "listPrice",
                "prices": [{
                    "currency": "USD",
                    "configuredPrice": 10
                }]
            }]
        }]  
    },
    "localizations": [
    {
      "locale": "en_US",
      "isDefault": "true",
      "groups": [
        {
          "groupId": "11",
          "groupName": "Software",
          "attributes": {
            "name": "product-name",
            "displayName": "Product Display Name",
            "sku": "product-sku",
            "manufacturer": "manufacturer-20220308-01",
            "mfrPartNumber": "mfrPartNumber-20220308-01",
            "returnMethod": "LOD",
            "productReturnMethod": "ByAgentAndSelfService",
            "taxableUnspscCode": "43210000",
            "taxableProductCode": "4321_C",
            "privateStoreOnly": true,
            "isViewable": true,
            "isOrderable": true,
            "nonSolr": true,
            "shortDescription": "shortDescription",
            "longDescription": "longDescription",
            "keywords": "keywords",
            "emailAddlInfoText": "emailAddlInfoText",
            "emailAddlInfo": "emailAddlInfo",
            "confirmAddlInfo": "confirmAddlInfo"
          }           
        },
        {
          "groupId": "16",
          "groupName": "Export Controls",
          "attributes": {
            "eccn": "3A992",
            "ccats": "display-name-1234test",
            "licenseException": "APP",
            "harmonizeCode": "hcode",
            "manufactureCountry": "US"
          }
        }   
      ]
    }
    ],
     "variations": [
         {
            "productType": "VARIATION",
            "companyId": "cast",
            "deploymentRequiredChanges": {
            },
            "varyingAttributes": [
                {
                    "attributeName": "platform",
                    "attributeValue": "1 user"
                },
                {
                    "attributeName": "fulfillmentType",
                    "attributeValue": "Download"
                }
            ],
             "localizations": [
                {
                    "locale": "en_US",
                    "isDefault": "true",
                    "groups": [
                        {
                            "groupId": "11",
                            "groupName": "Software",
                            "attributes": {
                                "name": "product-name-V1",
                                "displayName": "Product-display-V1",
                                "sku": "demo-sku-AAAA-V1",
                                "taxableUnspscCode": "43210000",
                                "taxableProductCode": "4321_C",
                                "isViewable": true,
                                "isOrderable": true,
                                "nonSolr": true
                            }
                        },
                        {
                            "groupId": "16",
                            "groupName": "Export Controls",
                            "attributes": {
                                "eccn": "3A992",
                                "ccats": "V1{{uuid}}",
                                "licenseException": "APP",
                                "harmonizeCode": "hcode",
                                "manufactureCountry": "US"
                            }
                        }
                    ]
                }
            ]
        }
        
     ]
}'
```

{% endtab %}

{% tab title="202 Accepted Response" %}
The request returns a task identifier (`taskId`) in the response.

```json
{
    "taskId": "add1797e-2f98-4e7a-9894-c71d6b5640bb",
    "requestType": "CREATE_PRODUCT",
    "taskStatus": "PUBLISHED",
    "receivedTime": "2022-12-13T09:13:24.370Z"
}
```

Use the `taskId` in the response to verify the successful completion of the request.  You can also verify the successful completion of the task by [checking the product history](#product-history-attributes) in [Global Commerce](https://gc.digitalriver.com/gc/ent/login.do). Note that there may be a delay before these chances appear in Global Commerce.&#x20;
{% endtab %}
{% endtabs %}

The following example verifies the successful completion of the request shown above.

{% tabs %}
{% tab title="cURL example 2" %}

```http
curl --location --request GET 
'https://api.digitalriver.com/v1/products/tasks/add1797e-2f98-4e7a-9894-c71d6b5640bb' \
--header 'Authorization: Bearer <API_key>' \
...
```

{% endtab %}

{% tab title="200 OK response" %}

```json
{
    "taskId": "add1797e-2f98-4e7a-9894-c71d6b5640bb",
    "products": [
        {
            "id": "51762690080",
            "productType": "BASE"
        },
        {
            "id": "51762700080",
            "productType": "VARIATION"
        }
    ],
    "requestType": "CREATE_PRODUCT",
    "taskStatus": "COMPLETED",
    "receivedTime": "2022-12-13T09:13:24.370Z",
    "finishedTime": "2022-12-13T09:13:25.019Z"
}

```

{% endtab %}
{% endtabs %}

## Physical and digital products

Use the Admin API fulfillment types (`fulfillmentTypes`) to define how to deliver products to shoppers. The options are empty (`""`), `physical` or `download`. When the value is empty, the product is neither physical nor digital (`download`). The empty value reflects the Other setting in [Global Commerce](https://gc.digitalriver.com/gc/ent/login.do) for service, warranty, entitlement, etc. Digital River supports two types of digital products: subscription and download.
