# Managing items with shared SKU identifiers

In a single Checkout or Invoice, you can add multiple [line items](https://docs.digitalriver.com/digital-river-api/order-management/creating-and-updating-an-order#line-items) that share a [SKU identifier](https://docs.digitalriver.com/digital-river-api/product-management/creating-and-updating-skus#specifying-a-sku-identifier) but differ in [price](https://docs.digitalriver.com/digital-river-api/integration-options/checkouts/creating-checkouts/describing-the-items/price-of-an-item), [discount type](https://docs.digitalriver.com/digital-river-api/integration-options/checkouts/creating-checkouts/applying-a-discount), or [subscription details](https://docs.digitalriver.com/digital-river-api/integration-options/checkouts/subscriptions/subscription-information-1).‌

The following sections demonstrate how items that share a `skuId` can be differentiated based on [price](#setting-different-prices) and [subscription information](#handling-multiple-subscription-requests) and how each item is assigned a [unique identifier in the Order response](https://docs.digitalriver.com/digital-river-api/order-management/creating-and-updating-an-order#line-items).

## Setting different prices

This [create checkout](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/checkouts#checkouts-1) request contains two items with the same `skuId` but different `price` values. In addition, one item has a `discount` applied to it.

{% tabs %}
{% tab title="curl" %}

```
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_key>' \
--header 'Content-Type: text/plain' \
--data-raw '
{
    "currency": "USD",
    "customerId": "987654321",
    "items": [
        {
            "skuId": "05081978",
            "price": 100.00,
            "quantity": 1
        },
        {
            "skuId": "05081978",
            "price": 90.00,
            "quantity": 1,
            "discount":
            {
                "percentOff": 10
            }
        }
    ]
}'
```

{% endtab %}
{% endtabs %}

Even though they share the same `skuId`, Digital River handles both items separately, returning different `amount` and `tax.amount` values for each.

{% tabs %}
{% tab title="JSON" %}

```javascript
{
    "id": "177406730336",
...
    "items": [
        {
            "skuId": "05081978",
            "amount": 100.0,
            "quantity": 1,
            "tax": {
                "rate": 0.07125,
                "amount": 7.13
            }
        },
        {
            "skuId": "05081978",
            "amount": 81.0,
            "quantity": 1,
            "discount": {
                "percentOff": 10.0,
                "quantity": 1
            },
            "tax": {
                "rate": 0.07125,
                "amount": 5.77
            }
        }
    ],
...
}
```

{% endtab %}
{% endtabs %}

The returned checkout `id` can then be used to [create an order](https://app.gitbook.com/s/ScJM6Hp95yBCPfU1nBSB/orders#orders-1). In the response to that [`POST /orders`](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/orders#orders-1) request, each element of the `items` array has been assigned a unique `itemId`.

{% tabs %}
{% tab title="JSON" %}

```javascript
{
    "id": "177406750336",
...
    "items": [
        {
            "itemId": "96361160336",
            "skuId": "05081978",
            "amount": 100.0,
            "quantity": 1,
...
            "tax": {
                "rate": 0.07125,
                "amount": 7.13
            }
        },
        {
            "itemId": "96361170336",
            "skuId": "05081978",
            "amount": 81.0,
            "quantity": 1,
            "discount": {
                "percentOff": 10.0,
                "quantity": 1
            },
...
            "tax": {
                "rate": 0.07125,
                "amount": 5.77
            }
        }
    ],
...
}
```

{% endtab %}
{% endtabs %}

## Handling multiple subscription requests

Perhaps you have a customer who wants to purchase an auto-renew digital magazine subscription for himself and another nearly identical subscription for a friend. The only difference is that the friend's subscription must be manually renewed.

In the [create checkout](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/checkouts#checkouts-1) or [create invoice](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/invoices#invoices-1) request, assign each item the same `skuId` but different `autoRenewal` and `subscriptionId` values.

{% tabs %}
{% tab title="curl" %}

```
curl --location --request POST 'https://api.digitalriver.com/checkouts' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_key>' \
--header 'Content-Type: text/plain' \
--data-raw '{
    "currency": "USD",
    "customerId": "987654321",
    "items": [
        {
            "skuId": "08141946",
            "subscriptionInfo": {
                "autoRenewal": true,
                "terms": "Insert terms here",
                "subscriptionId": "123"
            },
            "price": 100,
            "quantity": 1
        },
        {
            "skuId": "08141946",
            "subscriptionInfo": {
                "autoRenewal": false,
                "terms": "Insert terms here",
                "subscriptionId": "321"
            },
            "price": 75,
            "quantity": 1
        }
    ]
}'
```

{% endtab %}
{% endtabs %}

The returned checkout `id` can then be used to [create an order](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/orders#orders-1). In the response to that [`POST /orders`](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/orders#orders-1) request, each element of the `items` array has been assigned a unique `itemId`. Use these identifiers to [create](https://docs.digitalriver.com/digital-river-api/order-management/informing-digital-river-of-a-fulfillment) and [cancel](https://docs.digitalriver.com/digital-river-api/order-management/informing-digital-river-of-a-fulfillment) [fulfillments](https://docs.digitalriver.com/digital-river-api/order-management/fulfillments) and process [returns ](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/returns)and [refunds](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/refunds).

{% tabs %}
{% tab title="JSON" %}

```javascript
{
    "id": "177433630336",
    ...
    "items": [
        {
            "itemId": "96392860336",
            "skuId": "08141946",
            ...
            "subscriptionInfo": {
                "subscriptionId": "123",
                "terms": "Insert terms here",
                "autoRenewal": true,
                "freeTrial": false
            }
        },
        {
            "itemId": "96392870336",
            "skuId": "08141946",
            ...
            "subscriptionInfo": {
                "subscriptionId": "321",
                "terms": "Insert terms here",
                "autoRenewal": false,
                "freeTrial": false
            }
        }
    ],
...
}
```

{% endtab %}
{% endtabs %}
