# Step 8: Set up Digital River fulfillments

## Fulfillment process <a href="#fulfillment-process" id="fulfillment-process"></a>

The following sequence diagrams show the interaction between Shopper, Salesforce B2B Commerce, the Digital River Salesforce B2B Commerce App, and Global Commerce.

### Checkout <a href="#checkout" id="checkout"></a>

Salesforce kicks off the fulfillment process after it creates a [CC Order](#fulfillment). The following sequence diagram outlines the flow before fulfillment.

When the shopper reaches the payment methods page, Salesforce B2B Commerce creates a CC cart and sends an update order event to the Salesforce B2B Commerce App. The App uses Global Commerce (Commerce API) to create the shopper, get a full access token, update the shopper, and get the cart details. The App updates Salesforce with the tax details and the [selling entity](https://docs.digitalriver.com/salesforce-b2b/1.0-5/integrating-the-digital-river-salesforce-b2b-commerce-app/..#4-selling-entities) assigned to the order.

<div align="left"><img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MSZz591pV6sNHGmwR0h%2F-MS_0HFnOfqGvOU76tBI%2FSalesforce%20B2B%20Basic%20Fulfillment%20Flow.png?alt=media&#x26;token=02f35a3d-5f9a-4097-8363-d60add74b999" alt=""></div>

### Fulfillment <a href="#fulfillment" id="fulfillment"></a>

The following sequence diagram outlines the flow during fulfillment.

When a cart is successfully submitted, Salesforce renders an Order Confirmation page and creates a CC Order. The CC Order triggers the fulfillment steps.

ERP/Fulfillment receives the order. When they fulfill the order, they update the Order Item Status to Shipped. Salesforce updates the order status to Complete and sends it to the App. The Salesforce B2B Commerce App sends a WebService EFN to Global Commerce. Global Commerce updates the status to Complete, updates funds to Settled, and Sends a WebService OCN. The App sends a response code when it receives the OCN.

<div align="left"><img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MSZz591pV6sNHGmwR0h%2F-MS_0PlOiNEnzFDTF1X0%2FAPI%20Fulfillment%20Messages%2C%20URLs%20and%20Content.png?alt=media&#x26;token=95a19063-41cd-4409-8eaf-2f450920315e" alt=""></div>

The sequence diagram above outlines the flow of API fulfillment messages, URLs, and content during fulfillment.

Global Commerce sends a Digital River Order Fulfillment Information (OFI) notification to the App. The App creates a Digital River Fulfillment object with an order identifier and other order information to the shopper and then sends an OFI response code to Global Commerce.

Salesforce updates the order's Line Item status to Shipped. The App sends an Electronic Fulfillment Notification (EFN) for each line item, and Global Commerce sends a response. Once the App sends an EFN status for all line items, Global Commerce moves the order to the Completed state and captures the funds. Global Commerce then sends an Order Complete Notification (OCN) for the order to the App. The App updates the invoice as Paid and creates a new transaction for the capture to the shopper and then sends an OCN response code to Global Commerce.

## Step 8a: Create a connected app <a href="#step-8a-create-a-connected-app" id="step-8a-create-a-connected-app"></a>

To create a connected app for Digital River Fulfillments, complete the following steps:

1. Sign in to Salesforce B2B Commerce.
2. Click **Setup** ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MSZcl5f3veCNokPcvms%2F-MSZhViB6IBBd3jhKU9u%2FSetup.png?alt=media\&token=fac122c1-56eb-430e-9144-9d062c16bc19) and select **Setup** from the dropdown list.
3. Type `app manager` in the **Quick Find** field and press **Enter**.
4. Click **App Manager** in the search results. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MSZz591pV6sNHGmwR0h%2F-MS_0g7pjegxOVplxjkC%2FApp-Manager.png?alt=media\&token=584f7e0f-ea92-46a0-a9da-0314f2631c6e)
5. Click **New Connected App**.
6. Under **Basic Information**, type `DigitalRiver B2B Fulfillment Connector` in the **Connected App Name** field. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScB7Okv7ikhD0wRe5Q%2F-MScDoLkEbd_e2EXDLAa%2Fbasic-information.png?alt=media\&token=c9312a6d-52b7-407b-94d2-f72112881a38)
7. Provide your API name and your email address.
8. Select **Enable OAuth Settings**.
9. Under **API (Enable OAuth Settings)**, type `https://` in the Callback URL field. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MSZxa7H_SU6bc6teYxe%2F-MSZy3QAjv7dFl7Mftta%2FAPI-enabled-oauth-settings.png?alt=media\&token=3d120391-2754-4850-9871-e4412b73c38d)
10. Add **Access and manage your data (api)** to **Selected OAuth Scopes**. \
    ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScB7Okv7ikhD0wRe5Q%2F-MScF_toL6FQ-j1FDd_P%2FAccess-and-manage-your-data-api.png?alt=media\&token=9a096932-b5c5-4e12-b902-30cccf6c6372)
11. Select the **Require Secret for Web Server Flow** check box.
12. Click **Save**. Allow 2-10 minutes for your changes to take effect on the server before using the connected app.

## Step 8b: Create a profile <a href="#step-8b-create-a-profile" id="step-8b-create-a-profile"></a>

To create a profile and assign it to a Fulfillment Integration User, complete the following steps:

1. Create a new profile:

   a. Click **Setup** ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MSZcl5f3veCNokPcvms%2F-MSZhViB6IBBd3jhKU9u%2FSetup.png?alt=media\&token=fac122c1-56eb-430e-9144-9d062c16bc19) and select **Setup** from the dropdown list. \
   b. Under **Administration**, expand **Users**, and click **Profiles**. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScFlJPThk6KXKdlhKJ%2F-MScJCNS5WNfHzJEzoAr%2FProfiles.png?alt=media\&token=3e28b00d-6504-48c3-9390-fc94e092ad20) \
   c. From the Profiles page, click **New** to create a new profile. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScFlJPThk6KXKdlhKJ%2F-MScJNCoejq6QdY69CrZ%2Fprofiles-page.png?alt=media\&token=084af30c-6c7e-4189-90cd-2c96eaa119ab)\
   &#x20;d. Select **Standard User** from the **Existing Profile** dropdown list. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScFlJPThk6KXKdlhKJ%2F-MScK2EPjL03LPnM91i0%2Fclone-profile.png?alt=media\&token=1c670530-c3c1-4987-91b6-002911b9ab8f) \
   e. Type `DRB2B Connector API User Profile` in the **Profile Name** field. You're essentially cloning the Standard User profile to this new profile. \
   f. Click **Save**.
2. Set the password policy for this profile to never expire: \
   a. Under **Administration**, expand **Users**, and click **Profiles**. \
   b. Click the **DRB2B Connector API User Profile** link under the **Name** column on the Profiles page. \
   &#x20;<img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScM8YfvDR61ynNzfd5%2F-MScOpPj7G7XyXl-WiHD%2FDRB2B-Connector-API-User-Profile.png?alt=media&#x26;token=be859564-9925-4a7e-87a7-310adcea6672" alt="" data-size="original"> \
   c. Under **System** on the Profiles page, click the **Password Policies** link.\
   &#x20;![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScFlJPThk6KXKdlhKJ%2F-MScKAKraN5sve8tG6Kh%2FPassword-Policies.png?alt=media\&token=0a6722e1-3b0d-4471-8950-5b85c732de46) \
   d. Click **Edit**. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScM8YfvDR61ynNzfd5%2F-MScPS2z-s-xFlkyPVsH%2FEdit.png?alt=media\&token=30f782f5-a530-43f5-a48a-c8c015301897) \
   e. Select **Never expires** from the **User passwords expire in** dropdown list.\
   &#x20;![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScM8YfvDR61ynNzfd5%2F-MScPeywVvyehySuU4Ty%2FNever-Expires.png?alt=media\&token=8a7d0f51-8338-48e0-8e25-ff570e929749) \
   f. Click **Save**.
3. Create a Fulfillment Integration User and assign the user to this profile. \
   a. Under **Administration**, expand **Users**, and click **Profiles**. \
   b. Click the **DRB2B Connector API User Profile** link under the **Name** column on the Profiles page. \
   c. Click **Assigned Users**. \
   &#x20;<img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScFlJPThk6KXKdlhKJ%2F-MScLQuy4kp1mWHdOTu-%2FAssign-Integration-User.png?alt=media&#x26;token=05aa8843-c228-4d7f-98e2-32c353613bb8" alt="" data-size="original"> \
   d. Click **New User**. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScFlJPThk6KXKdlhKJ%2F-MScLWtyjSY1qsOjzX1F%2FNew-User.png?alt=media\&token=bd10791b-83eb-412f-aa22-6e4733d7414a) \
   e. Assign a Fulfillment Integration User to this profile, complete the required fields, and click **Save**.\
   &#x20; <img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScM8YfvDR61ynNzfd5%2F-MScQ-kd2fSkKNpo8MKs%2FNew-User-page.png?alt=media&#x26;token=52980b5a-edab-4b17-a936-9a3f315806e8" alt="" data-size="original"> \
   **Note**: You will need the username and password for the Fulfillment Integration User in [Step 8d: Send OAuth information to Digital River](#step-8d-send-oauth-information-to-digital-river).

## Step 8c: Assign the Fulfillment Integration User to the Digital River Salesforce B2B Commerce App Permission Set <a href="#step-8c-assign-the-fulfillment-integration-user-to-the-drb-2-b-connect-app-permission-set" id="step-8c-assign-the-fulfillment-integration-user-to-the-drb-2-b-connect-app-permission-set"></a>

To add the new user to the Digital River Salesforce B2B Commerce App Permission Set:

1. Type `permission sets` in the **Quick Find** field and press **Enter**. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScQ36OKYizuzHgF1Yn%2F-MScQF_BRoa5h6uiFTu_%2FSearch-for-permission-sets.png?alt=media\&token=6babb504-0c91-450d-9f9a-30e59c6adae6)
2. Click **Permission Sets**. The Permission Sets page appears.
3. From the Permission Sets page, click the **DRB2B Connect App Permission Set** link.\
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScQ36OKYizuzHgF1Yn%2F-MScTAoxSYK0xd-HufUt%2FDRB2B-Connect-App-Permission-Set.png?alt=media\&token=416f8b14-ced5-45a7-80b7-ee9827f7543b)
4. Click **Manage Assignments**. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MS_BFy65ve_8KepASPe%2F-MS_CTwmCAVM3sK4O5Dd%2FDRB2B-Permission-Set-page.png?alt=media\&token=23b11e15-9099-4003-8277-0e04baeb0375)
5. Click **Add Assignments**. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScQ36OKYizuzHgF1Yn%2F-MScTOvXKVaVymF1Z_fL%2FAdd-Assignments.png?alt=media\&token=b8bcf7ca-804d-46ca-9d57-f9e8b2971ace)
6. Select one or more users who you want to assign to this permission set and click **Assign**.\
   &#x20;![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScQ36OKYizuzHgF1Yn%2F-MScTWLP2XQTzTEdGupe%2FAssign.png?alt=media\&token=4e627734-a752-441b-a695-988105f7eb41) \
   The assigned users now appear in the DRB2B Connect App Permission Set.

## Step 8d: Send OAuth information to Digital River <a href="#step-8d-send-oauth-information-to-digital-river" id="step-8d-send-oauth-information-to-digital-river"></a>

Your Digital River Project Manager needs your OAuth information to set up your OAuth Fulfillment flow. To collect and send the required information, complete the following steps:

1. Click **Setup** ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MSZcl5f3veCNokPcvms%2F-MSZhViB6IBBd3jhKU9u%2FSetup.png?alt=media\&token=fac122c1-56eb-430e-9144-9d062c16bc19) and select **Setup** from the dropdown list.
2. Type `app manager` in the **Quick Find** field and press **Enter**.\
   &#x20;<img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MSZz591pV6sNHGmwR0h%2F-MS_0g7pjegxOVplxjkC%2FApp-Manager.png?alt=media&#x26;token=584f7e0f-ea92-46a0-a9da-0314f2631c6e" alt="" data-size="original">&#x20;
3. Click **App Manager** in the **Quick Find** field. ​
4. Locate the **Digital River B2B Fulfillment App** row, click **Show more actions** ![](https://firebasestorage.googleapis.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-MBAqKPiXugAQI_J5f3e%2F-MBiqG89p3QSi_8kkdPf%2F-MBiucMOfwyZunUprKUZ%2FShow-more-actions.png?alt=media\&token=9be6a260-c1d6-4253-b3d2-bf1576e7f4bf), and select **View** from the dropdown list. The Digital River B2B Fulfillment App page appears.\
   &#x20;![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScU05OLiQxmyNTDq--%2F-MScUcTQAqZdK1Dp1yiw%2FDigital-River-B2B-Fulfillment-Connector.png?alt=media\&token=0ea7e37c-6c79-4d81-a623-9cea731b99c8)
5. Collect the following information from this page:
   * **Consumer Key**–This is your Digital River client ID.
   * **Consumer Secret**–This is your Digital River client secret.
6. Type `My Domain` in the **Quick Find** field and press **Enter**. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScU05OLiQxmyNTDq--%2F-MScUiqlx1RDbZrTQHcc%2FSearch-for-my-domain.png?alt=media\&token=4f2275a8-4642-4ec1-9906-99e820910394)
7. Click **My Domain**. The My Domain page appears.
8. Collect your Salesforce domain name from **Your domain name is**. \
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScU05OLiQxmyNTDq--%2F-MScVbF2vMBGAJYZ8i7y%2FYour-domain-name-is.png?alt=media\&token=bd215fb9-59a2-43f5-b7a6-c5d21b39af62)
9. Send the following information to your Digital River Project Manager:

   * Your salesforce domain name, for example:\
     `https://<custom>.my.salesforce.com` \
     Where <`custom`> is the custom portion of your domain name where you will send the OFI or OCN notification.
   * Your Digital River client ID
   * Your Digital River client secret
   * Your `grant_type` is `password`
   * Your password. Your password is a combination of the Salesforce user name for your Fulfillment Integration User followed by their security token using the following format: <*password>\<securitytoken>*\
     Note that there is no space between the password and the security token.

   Digital River will set up the Digital River B2B Commerce Fulfillment App under Manage Connected Apps.

## Resources <a href="#resources" id="resources"></a>

Digital River uses the following resources for fulfillments:

* **​**[**Order-level Electronic Fulfillment Information (OFI) Notification**](#ofi-notification)–You need to wait for the OFI message from Digital River before you fulfill an order.\
  `<instance_url>/services/apexrest/digitalriverb2b/DROFINotification/`
* **Order Completion Notification (OCN)**–Digital River triggers an OCN once Digital River has received an EFN with a `Shipped` or `Cancel` status for every line item in the order. This message tells Salesforce that Digital River has settled the order.

### OFI Notification <a href="#ofi-notification" id="ofi-notification"></a>

When Salesforce receives a successful response, it will create the Digital River Fulfillment object. The object includes the CC Order ID, DR Order ID, Status, and so on. This object is important for ElectronicFulfillment Notification.

If you look at the CC Order Item Detail, you will see the **Order Item Status**:

<div align="left"><img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScViinVk3SAfIdBQzF%2F-MScVujzoX2WljbhsqJo%2FCC-Order-Item-Detail.png?alt=media&#x26;token=507f2729-fb5e-4ada-9c64-b4b93776f8a1" alt=""></div>

When you set the **Order Item Status** to **Shipped**, it creates a new DR (Digital River) Line Item Fulfillment Detail object.

<div align="left"><img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScVwpyvEiHRjTBCidt%2F-MSc_Ng0r9z-5edsVrj_%2FDigital-River-Line-Item-Fulfillment-Detail.png?alt=media&#x26;token=39a95376-fc14-4455-b76b-6d17d5854afb" alt=""></div>

A scheduler job that looks for **Open** or **Pending** statuses in the **EFN Order Item Status** field for this object runs every five minutes.

These line items are then sent in the EFN job to Digital River with a status of `Shipped`. When Digital River receives the `Shipped` status, we will capture the funds (submit the request for payment for the payment method).

The following statuses drive the Digital River payment processing:

| Order Status              | Expected Next Step             |
| ------------------------- | ------------------------------ |
| Shipped / Partial Shipped | Payment auth will settle       |
| Cancelled                 | Payment auth will reverse/void |

## Set up OAuth programmatically <a href="#appendix-set-up-oauth-programmatically" id="appendix-set-up-oauth-programmatically"></a>

{% hint style="warning" %}
Digital River has to set up the Digital River Salesforce B2B Commerce App under Manage Connected Apps before you can perform this step.
{% endhint %}

Read this section if you want to set up OAuth programmatically for fulfillment.

### Get an access token <a href="#get-an-access-token" id="get-an-access-token"></a>

To initiate a session and get an access token, send a Token call to one of the following environments:

* **Test environment URL**: <https://test.salesforce.com/services/oauth2/token>
* **Production environment URL**: <https://login.salesforce.com/services/oauth2/token>

#### Setting token parameters <a href="#setting-token-parameters" id="setting-token-parameters"></a>

When you request a token, you'll need to provide the required parameters listed in the following table.

| Parameter      | Required/Optional | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| -------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| grant\_type    | Required          | The enumerator is `password`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| client\_id     | Required          | The Salesforce consumer key for the connected App.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| client\_secret | Required          | The Salesforce consumer secret for the connected App.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| username       | Required          | The Fulfillment Integration User's Salesforce email address.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| password       | Required          | <p>The password format is a combination of the Fulfillment Integration User's Salesforce password and security token, for example:<br><em>\<Fulfillment Integration User's password>\<Fulfillment Integration User's security token></em></p><p>Note that there is no space between the password and the security token.</p><p>To access or reset the security token:</p><ol><li>Click <strong>View Profile</strong> <img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MP5OnTZMnMucMnhnG7S%2F-MP5PLcUlbgcwwr1ep9n%2FToken.png?alt=media&#x26;token=254e4bc5-b1d7-4614-a3b5-d0539a513181" alt="" data-size="line">  and then click <strong>Settings</strong>.</li><li>Click <strong>Reset My Security Token</strong>.</li><li>Click <strong>Reset Security Token</strong>. You will receive an email with your security token.</li></ol> |

#### Example Get Access Token request and response <a href="#example-get-access-token-request-and-response" id="example-get-access-token-request-and-response"></a>

1. Expand the collection that contains your fulfillment APIs and open the **Get Access Token** request.
2. In the body of the request, provide the values for the [required Token parameters](#setting-token-parameters), and click **Send**.

<div align="left"><img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScVwpyvEiHRjTBCidt%2F-MScbpkVC2kozzJw31Ml%2FPOST-OAuth2-Token.png?alt=media&#x26;token=6672fd96-0b2a-415f-97bf-85b8b720c876" alt=""></div>

A successful response returns the token information:

<div align="left"><img src="https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScVwpyvEiHRjTBCidt%2F-MSccBHMGqE9N8KF41hz%2FGet-Access-Token-response.png?alt=media&#x26;token=52604b63-d61a-4a7a-b467-d7208d4c6bd0" alt=""></div>

The `access_token` is the Bearer code. The fulfiller uses this Bearer code when sending subsequent fulfillment API calls.

### Send order-level Electronic Fulfillment Information (OFI) <a href="#send-order-level-electronic-fulfillment-information-ofi" id="send-order-level-electronic-fulfillment-information-ofi"></a>

You must wait for the OFI message from Digital River before you fulfill an order.

To send a POST OFI, use the following URL format:

`/services/apexrest/digitalriverb2b/DROFINotification/`

Example:

`https://acme.my.salesforce.com/services/apexrest/digitalriverb2b/DROFINotification/`

#### Setting DROFINotification parameters <a href="#setting-drofinotification-parameters" id="setting-drofinotification-parameters"></a>

| Parameter     | Required/Optional | Value                    | Description                                                                                                                                                                                                |
| ------------- | ----------------- | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization | Required          | Bearer <*access\_token*> | <p>Use the <code>access\_token</code> value  from your <a href="#get-an-access-token">token request</a> for your <<em>token</em>></p><p>This is a dynamic value. It changes each time you get a token.</p> |
| Content\_Type | Required          | application/JSON         | This is a static value.                                                                                                                                                                                    |
| Accept        | Required          | application/JSON         | This is a static value.                                                                                                                                                                                    |

#### Example POST DROFINotification request and response <a href="#example-post-drofinotification-request-and-response" id="example-post-drofinotification-request-and-response"></a>

1. Expand the collection that contains your fulfillment APIs and open the **POST DROFINotification** request.
2. Ensure the POST URL includes the `instance_url` from the [Get Access Token response](#example-get-access-token-request-and-response). and include the following suffix: `/services/apexrest/digitalriverb2b/DROFINotification/` For example:`https://tbdclient--docqa.my.salesforce.com/services/apexrest/digitalriverb2b/DROFINotification/`
3. Click **Headers**, replace the Bearer code with the `access_token` from [Get an access token](#get-an-access-token), and provide the values for the remaining [required DROFINotification parameters](#setting-drofinotification-parameters).\
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScVwpyvEiHRjTBCidt%2F-MSccVTK-DJg6P5ymr7K%2FPOST-OAuth2-Token.png?alt=media\&token=f2e46971-d5af-4ae8-8a9a-fc2c6f0a7020)
4. Click [**Body**](#body), replace the value for `requisitionID` with the DR Order ID value from the CC Order:\
   ![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScVwpyvEiHRjTBCidt%2F-MScfEWt-DRedaCUcqw1%2FDR-Order-ID.png?alt=media\&token=ecff53c2-3b07-4a42-ad68-27133366c09b) \
   Note that you only need to modify the `requisitionID`. Do not modify the remaining request body content.
5. Click **Send**.

### Send Order Completion Notification (OCN) <a href="#send-order-completion-notification-ocn" id="send-order-completion-notification-ocn"></a>

{% hint style="warning" %}
[Create a new access token](#get-an-access-token) before sending the OCN.
{% endhint %}

Digital River triggers an OCN once Digital River has received an EFN with a `Shipped` or `Cancel` status for every line item in the order. This message tells Salesforce that Digital River has settled the order.

To send the OCN, use the following URL format:

`<`*`Instance_url`*`>/services/apexrest/digitalriverb2b/DROrderCompleteNotification/`

Example:

`https:// acme.my.salesforce.com/services/apexrest/digitalriverb2b/DROrderCompleteNotification/`

#### Setting DROrderCompleteNotification parameters <a href="#setting-drordercompletenotification-parameters" id="setting-drordercompletenotification-parameters"></a>

| Parameter     | Required/Optional | Value                    | Description                                                                                                                                                                                                |
| ------------- | ----------------- | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization | Required          | Bearer <*access\_token*> | <p>Use the <code>access\_token</code> value  from your <a href="#get-an-access-token">token request</a> for your <<em>token</em>></p><p>This is a dynamic value. It changes each time you get a token.</p> |
| Content\_Type | Required          | application/json         | This is a static value.                                                                                                                                                                                    |
| Accept        | Required          | application/json         | This is a static value.                                                                                                                                                                                    |

#### Example POST DROrderCompleteNotification request and response <a href="#example-post-drordercompletenotification-request-and-response" id="example-post-drordercompletenotification-request-and-response"></a>

1. Expand the collection that contains your fulfillment APIs and open the **POST** DROrderCompleteNotification request.
2. Ensure the POST URL includes the `instance_url` from the [Get Access Token response](#example-get-access-token-request-and-response) and include the following suffix: `/services/apexrest/digitalriverb2b/DROrderCompleteNotification/` For example: `https://tbdclient--docqa.my.salesforce.com/services/apexrest/digitalriverb2b/DROFINotification/`
3. Click **Headers**, replace the Bearer code with the `access_token` from [Get an access token](#get-an-access-token), and provide the values for the remaining [required DROrderCompleteNotification parameters](#setting-drordercompletenotification-parameters).\
   &#x20;![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScVwpyvEiHRjTBCidt%2F-MScgd6FR-pEusGeJxDg%2FPOST-DROrderCompleteNotification.png?alt=media\&token=0b9b3631-295f-4820-9329-8e4926531d1e)
4. Click [**Body**](#body), replace the value for `orderID` with the DR Order ID value from the CC Order:\
   &#x20;![](https://2536014854-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNZuPvN3iGOwRD0PjQh%2F-MScVwpyvEiHRjTBCidt%2F-MScfEWt-DRedaCUcqw1%2FDR-Order-ID.png?alt=media\&token=ecff53c2-3b07-4a42-ad68-27133366c09b) \
   Note that you only need to modify the `orderId`. Do not modify the remaining request body content.
5. Click **Send**.
