# Processing subscription acquisitions

If you're pairing either of Digital River's [low-code checkout solutions](/digital-river-api/integration-options/low-code-checkouts.md) with [our subscription service](/digital-river-api/using-our-services/subscriptions.md), this page explains how to process:

* [Standard subscription acquisitions](#building-acquisitions)
* [Trial subscription acquisitions](#managing-trial-subscription-acquisitions)

Once Digital River converts the [checkout-session](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/drop-in-checkout-sessions) to an [order](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/orders), you must activate the subscription, fulfill the goods, and manage renewals. For details on handling these and other processes, refer to the [Managing a subscription ](/digital-river-api/subscription-management/managing-a-subscription.md)page.

## Subscription acquisitions <a href="#building-acquisitions" id="building-acquisitions"></a>

During a standard subscription acquisition, your [create checkout-session request](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/drop-in-checkout-sessions#drop-in-checkout-sessions) must pass `subscriptionInfo` in `items[]`.

For each `items[].subscriptionInfo` in the request:

* Use `planId` to associate the [subscription](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/subscriptions/subscription-basics) with a [plan](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/plans/plan-basics). For details, refer to [Defining a business model](/digital-river-api/using-our-services/subscriptions.md#defining-a-business-model).
* Include `terms`. To do this, [get the plan that the subscription belongs to](https://www.digitalriver.com/docs/digital-river-api-reference/#tag/Plans) before submitting the request. From the response, retrieve the [plan's ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/plans/plan-basics)`terms` and pass that value in the request.\
  \
  If you don't pass `terms`, a `400 Bad Request` with a `code` of `missing_parameter` is returned.
* Set `autoRenewal` to `true` or omit the value. If you set this parameter to `false`, a `400 Bad Request` with a `code` of `invalid_request` is returned.
* If you don't provide a unique `subscriptionId`, we generate one for you.

Your request must also pass a [`customerId` ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/drop-in-checkout-sessions/checkout-sessions-basics#customer-identifier)and should specify a `chargeType` of `customer_initiated`.

Acquisition requests can also contain:

* [Multiple `items[]` with `subscriptionInfo`](#subscriptions-with-multiple-line-items)
* [A mix of both subscription and non-subscription `items[]`](#mixed-carts)

#### Multiple `items[]` with `subscriptionInfo` <a href="#subscriptions-with-multiple-line-items" id="subscriptions-with-multiple-line-items"></a>

Your [create checkout-session request](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/drop-in-checkout-sessions#drop-in-checkout-sessions) can contain multiple `items[]` with `subscriptionInfo`. However, all these recurring `items[]` have to share the same `planId` and (if you pass your own value) `subscriptionId`.

If your request contains multiple `items[]` with `subscriptionInfo` and they reference different [plans](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/plans/plan-basics), then the following error is returned:

{% tabs %}
{% tab title="409 Conflict" %}

```javascript
{
    "type": "conflict",
    "errors": [
        {
            "code": "plan_limit_reached",
            "parameter": "planId",
            "message": "Only one unique subscription plan can be supported in a checkout"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

#### Mixed subscription and non-subscription `items[]` <a href="#mixed-carts" id="mixed-carts"></a>

Your [create checkout-session request](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/drop-in-checkout-sessions#drop-in-checkout-sessions) can also have a mix of `items[]`, some with and some without `subscriptionInfo`. This allows you to, for example, process transactions that combine purchasing a one-time physical product with a recurring digital subscription.

## Trial subscription acquisitions <a href="#managing-trial-subscription-acquisitions" id="managing-trial-subscription-acquisitions"></a>

You handle free-trial acquisitions in much the same way as [standard subscription acquisitions](#building-acquisitions).

However, in free trials, you must slightly modify your [create checkout-session request](https://www.digitalriver.com/docs/digital-river-api-reference/#tag/Drop-in-Checkout-Sessions/operation/createDropInCheckoutSession).

For each trial-based `items[]` in the request:

* Pass a `price` or `aggregatePrice` of `0.0`
* In its `subscriptionInfo`:
  * Set `freeTrial` to `true`
  * Pass a `planId` that references a [trial period plan](/digital-river-api/using-our-services/subscriptions.md#trial-period-plans).

If your request contains an `items[]` whose (1) `subscriptionInfo.freeTrial` is `true` and its `price` or `aggregatePrice` is greater than `0.0` or (2) whose `subscriptionInfo.freeTrial` is `false` and its `price` or `aggregatePrice` is `0.0`, then the following error is thrown:

{% code title="400 Bad Request" %}

```javascript
{
    "type": "bad_request",
    "errors": [
        {
            "code": "invalid_parameter",
            "parameter": "items",
            "message": "The value of the Free Trial flag is not consistent with the item price or the aggregate price."
        }
    ]
}
```

{% endcode %}

For details on processing a trial-based subscription after Digital River converts the acquisition [checkout-session](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/drop-in-checkout-sessions/checkout-sessions-basics) to an [order](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/orders), refer to [Trial subscription management](/digital-river-api/subscription-management/managing-a-subscription.md#trial-subscription-management) on the [Subscription management](/digital-river-api/subscription-management/managing-a-subscription.md) page.

## How Digital River processes your requests <a href="#handling-the-response" id="handling-the-response"></a>

For each `items[]` with `subscriptionInfo` sent in the [create checkout-session request](https://www.digitalriver.com/docs/digital-river-api-reference/#tag/Drop-in-Checkout-Sessions/operation/createDropInCheckoutSession), Digital River creates a single [subscription](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/subscriptions), sets its to [`state` ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/subscriptions/subscription-basics#state)to `draft` and then generates an [event ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/events)with a [`type`](/digital-river-api/order-management/events-and-webhooks-1/events-1.md#event-types) of [`subscription.created`](https://docs.digitalriver.com/digital-river-api/integration-options/low-code-checkouts/pages/okHqAQ9d1PaLPLjq6nZF#subscription.created).

{% hint style="info" %}
The event's [`data.object`](/digital-river-api/order-management/events-and-webhooks-1/events-1.md#event-data) doesn't contain [key subscription attributes](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/subscriptions/subscription-basics) such as `contractBindingUntil`, `nextReminderDate`, `currentPeriodEndDate`, and `nextInvoiceDate`. These are populated after you [activate the subscription](/digital-river-api/subscription-management/managing-a-subscription.md#activating-a-subscription).
{% endhint %}

Digital River also presents customers with a localized, recurring billing agreement in the payment collection stage and forces them to accept it before they can submit the order.

{% tabs %}
{% tab title="Prebuilt Checkout" %}
{% hint style="success" %}
In [Prebuilt Checkout](/digital-river-api/integration-options/low-code-checkouts/drop-in-checkout.md), we retrieve the [`interval` and `intervalCount`](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/plans/plan-basics#contract-length-and-interval) of the [plan](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/plans) that the [subscription](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/subscriptions) belongs to and present this information in the order summary section.
{% endhint %}

<div align="left"><figure><img src="/files/tteYHPy0oCfWbLR51zA6" alt=""><figcaption></figcaption></figure></div>
{% endtab %}

{% tab title="Payment Component" %}

<div align="left"><figure><img src="/files/7bFUB0SEjE2lU65tXJI4" alt=""><figcaption></figcaption></figure></div>
{% endtab %}
{% endtabs %}

To make the [primary payment `sources[]`](/digital-river-api/payments/payment-sources/using-the-source-identifier.md#primary-payment-sources) [reusable](/digital-river-api/payments/payment-sources.md#reusable-or-single-use), Digital River saves it to the [customer](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/customers) referenced by [`customerId`](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/drop-in-checkout-sessions/checkout-sessions-basics#customer-identifier).

Refer to the[ Managing a subscription](/digital-river-api/subscription-management/managing-a-subscription.md) page to learn more about activating subscriptions and handling renewals.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalriver.com/digital-river-api/integration-options/low-code-checkouts/processing-subscription-acquisitions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
