# Creating a webhook

Creating a webhook allows your system to receive real-time notifications from Digital River, enabling you to automate and enhance your processes. Whether you're tracking subscription updates, inventory statuses, or any other events, setting up a webhook is a straightforward process that involves opening your firewall to Digital River IPs, creating the webhook in your Digital River project, and configuring your system to respond to the events. Follow these simple steps to get started.

You can create a webhook to send notifications in three easy steps.

* [Step 1: Open your firewall to trusted Digital River IP addresses](#step-1-open-your-firewall-to-trusted-digital-river-ip-addresses)
* [Step 2: Create webhooks](#step-2-create-webhooks)
* [Step 3: Respond to webhook events](#step-3-respond-to-webhook-events)

## Step 1: Open your firewall to trusted Digital River IP addresses

To receive webhook notifications from Digital River, you must open your firewalls to all trusted Digital River IP addresses listed in the Commerce API safelist. See the [Commerce API Safelist](https://docs.digitalriver.com/commerce-api/events/webhooks/commerce-api-safelist) section for trusted Digital River IP addresses.

## Step 2: Create webhooks

When creating webhooks, you need to add endpoints from Global Commerce:

1. Sign in to [Global Commerce](https://gc.digitalriver.com/gc/ent/login.do).
2. Select **Administration**, and then click **Webhook Service**. The Webhook Service page appears.\
   &#x20;<img src="https://2721412755-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzlYMEYC0GeLSgnsft6%2F-MfYheHYer7gK_4Brq-r%2F-MfYkGIdl9jGNxOzb4zn%2FWebhook-Service.png?alt=media&#x26;token=d86b3b23-612e-498c-9cb7-345889946d8b" alt="" data-size="original">&#x20;
3. From the Webhook Service page, click **Create Webhook**.  \ <img src="https://2721412755-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzlYMEYC0GeLSgnsft6%2F-MfYheHYer7gK_4Brq-r%2F-MfYjsfAy_5mikDI-N7n%2FWebhook-Service-Create-webhook.png?alt=media&#x26;token=b40bb741-4c9b-4fe1-b458-44b1e7097efe" alt="" data-size="original"> \
   The Create Webhook page appears.\
   ![](https://2721412755-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzlYMEYC0GeLSgnsft6%2Fuploads%2FEfrHELXSJRRacq4ZskOi%2FCreate%20Webhook.png?alt=media\&token=f60b29e3-9d17-46a8-be37-b4c628e523b6)&#x20;
4. Enter the URL for the endpoint in the **Endpoint URL** field. The endpoint URL will receive the webhook payload. The URL must start with either `https://` or `http://`.
5. Choose either **HTTP** or **OAUTH** as the **Transport Type**.

   * **HTTP**: Provide the following information to create HTTP-configured webhooks:
     * **Username**: Type your username.
     * **Password**: Type your password.

   <figure><img src="https://2721412755-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzlYMEYC0GeLSgnsft6%2Fuploads%2FFjtboviW3d8Wn0756s55%2FAuthentication.png?alt=media&#x26;token=54ab8257-dda2-45ec-9322-ac92304dd37d" alt=""><figcaption></figcaption></figure>

   * **OAUTH**: To create OAuth2-configured webhooks, provide the following information:
     * **Grant type**: Choose either **Client credentials** or **Password**.
     * **Token endpoint URL**: Type the URL for the token endpoint starting with the `HTTP://` or `HTTPS://`.
     * **Username**: Type your username. Username and Password only appear if you choose Password as the Grant type.
     * **Password**: Type your password.
     * **Client ID**: Provide the API key for your account.
     * **Client secret**: Provide the confidential key for your account.

   <div align="left"><figure><img src="https://2721412755-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzlYMEYC0GeLSgnsft6%2Fuploads%2FeaSPG1Py7VKUAPHeCtTB%2FOAuth.png?alt=media&#x26;token=b0b641f9-c94a-4e68-9858-6c410337c4e0" alt=""><figcaption></figcaption></figure></div>
6. Optional. Select **Enabled** for **Status**. \
   \
   **Note**: If you do not select **Enabled**, no payment will be sent when an event occurs. Also, the system will ask you if you want to enable the webhook when you click **Create**.
7. Select the checkbox next to each event you want to associate with the endpoint, or select the checkbox next to **Event** to select all events. You must select at least one [event type](https://docs.digitalriver.com/commerce-api/events/event-types/subscription-event-types).&#x20;

<div align="left"><figure><img src="https://2721412755-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzlYMEYC0GeLSgnsft6%2Fuploads%2FLucnYnAsQgu2XOMkVsiS%2FEvents.png?alt=media&#x26;token=a259ab5b-aef0-4aaf-b4fa-f972e2ae0797" alt=""><figcaption></figcaption></figure></div>

8. Scroll down and click **Create**. By following these steps, you will successfully subscribe to selected event types, enabling your systems to receive notifications and respond to changes promptly.

## Step 3: Respond to webhook events

Your endpoint must return a `2xx` HTTP status code to acknowledge the receipt of an event. If the endpoint fails to acknowledge events over several days, your endpoint will be disabled.

You will not receive the event if Digital River receives response codes outside this range. For example, Digital River treats a URL redirection as a failure.
