# Managing subscriptions

A subscription is an arrangement for providing, receiving, or making use of something of a continuing or periodic nature on a (pre)payment plan. The Salesforce B2B Commerce App currently supports the processing of recurring installment payments.

The App comes with two batch jobs to process recurring installment payments.

* CC Subscription Installment Processor job:
  1. Runs on a schedule and picks the CC Subscription records for which recurring Installment payment needs to be processed.
  2. Creates a CC Cart and adds the subscription product that is stamped on the CC Subscription record.
  3. The Cart status will be set to the Custom Digital River status "Open-DR" so that it is not visible in the Storefront when the user logs in.
  4. Updates the Subscription Installment Count and Installment Next Run date on the CC Subscription record.
  5. Creates a DR Subscription Process Data record and populates it with Cart, Cart Item, Parent Order Id, Transaction Payment, Stored Payment, Subscribed Product, User, Contact, Account, and other information required for DR Order submission.
* DR Subscription Processor job:
  1. Query all DR Subscription Process Data records whose `Recurring Payment` flag is `False` and the Subscription Job Run status field is set to `Open` ordered by Installment Run date.
  2. This job goes through the entire checkout flow. That is, it makes calls to Digital River to get Tax, Create DR Order and Populate the DR Order information in Salesforce.
  3. If this job is successful, then it sets the `Is Recurring Payment Processed` flag to `true` and Subscription Job Run Status to `Successful`.
  4. If this job fails, then it sets the `Is Recurring Payment Processed` flag to `false` and Subscription `Job Run Status` to `Open` or `Failed` depending on the Subscription Retry Count value on this record.
     1. If the Subscription Retry count field on this record exceeds the maximum retry count set in the configuration, then the `Subscription Job Run Status` is set to `Failed`.
     2. If the Subscription Retry count field on this record is less than the maximum Retry count set in the Configuration, then the `Subscription Job Run Status` is set to `Open` so that this record is processed again next time.

The following sequence diagram explains the Recurring Installment Subscription Payment Process supported by the connector.

<div align="left"><img src="/files/-MT6fBMi7FxMLRRhC_FN" alt=""></div>


---

# 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/salesforce-b2b/2.0-2/managing-subscriptions.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.
