Creating a webhook

Learn how to create a webhook.

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

Step 1. Open your firewall to trusted Digital River IP addresses

To receive webhook notifications from Digital River, you'll need to open your firewall to all the IP addresses listed in the Digital River whitelist.

Step 2. Create a webhook endpoint

You can send webhook data as JSON in the POST request body. The POST request body contains the complete event details, and you can use it after parsing the JSON into an Event object.

Step 3. Create webhooks

To create a webhook, choose one of the following options:

Create a webhook programmatically

To add event types and an endpoint URL to a webhook programmatically:

Setting Webhook parameters

When you create a webhook, you'll need to provide the required parameters listing in the following table. The remaining parameters are optional:

Parameter

Required/Optional

Description

type

Required

The type of event. See Event types for the list of supported types.

apiVersion

Optional

Indicates whether to use the current default version of the API or the latest version of the API. The enumerators are latest and default.

enabled

Optional

Indicate that webhook is enabled and receives notifications or is not enabled and does not receive notifications

address

required

URL of the webhook endpoint on your server that you set up to receive webhook notifications. We send webhook data as JSON in the POST request body. The full event details are included and can be used directly, after parsing the JSON into an Event object.

Example create and response

Create a Webhook object with a POST request:

cURL
cURL
curl https://api.digitalriver.com/skus \
-u sk_test_db9682a2-b04a-4e94-8e11-35fe8ec0b324: \
-d "type": ["order.created"] \
-d "apiVersion": "default" \
-d "enabled": true \
-d "address": "https://company.com"

A 201 Created response returns a Webhook object:

JSON
JSON
{
"id": "string",
"createdTime": "2020-05-11T21:26:43Z",
"updatedTime": "2020-05-11T21:26:43Z",
"type": [
"order.created"
],
"apiVersion": "default",
"enabled": true,
"address": "https://company.com"
}

Create a webhook from the Dashboard

To add event types and an endpoint URL to a webhook from the Dashboard:

  1. Sign in to the Dashboard.

  2. Click Webhooks.

  3. From the Webhooks page, click Create Webhook.

  4. Toggle Disabled to Enabled.

  5. Enter the URL for the endpoint in the Endpoint URL field.

  6. Select the check box next to each event you want to associate with the endpoint or select the Events Selected check box to select all events.

  7. Scroll down and click Save.

Step 4. 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.

If Digital River receives any response codes outside this range, it indicates that you did not receive the event. For example, Digital River treats a URL redirection as a failure.

Once you have verified your endpoint can receive, acknowledge, and handle events correctly:

  1. Toggle from Test to Live in the Dashboard.

  2. Go through the same configuration steps again to configure an endpoint for your live integration.

If you're using the same endpoint for both test and live modes, the signing token is unique to each data mode.

Step 5. Check signatures

To verify signatures, you need to retrieve your endpoint's token from the Dashboard's Webhooks settings. To see an endpoint's token:

  1. From the Webhooks page on the Dashboard, click the Reveal token or Reveal test token associated with the endpoint you want to verify.

  2. Provide your credentials and click Authenticate. The Token field under Signing secret will display the token.

See Digital River signature for more information.