Responding to events

Learn how to create and manage events and webhooks.

Whenever specific actions or changes occur, such as an automatic renewal reminder for a subscription or inventory levels being updated, the Digital River sends notifications to your application through webhooks. By effectively responding to these events, you can automate processes, synchronize your store data, and enhance the overall customer experience. This section will guide you on how to set up and manage your responses to various store events using the Commerce API.

Webhook events are specific actions or changes in your online store system that you can subscribe to using the Commerce API. When such an event occurs, it triggers a notification sent to your application through a webhook. This enables your application to react in real-time to changes or activities within your store, such as delayed payment reminders, subscription updates, or renewal reminders. Examples of webhook events include subscription_created, subscription.updated, or subscription.payment_failed. By subscribing to relevant webhook events, you can ensure your application stays in sync with your online store, improving operational efficiency and customer experience.

The Commerce API allows you to create and manage events and webhooks. You can use webhooks to subscribe to these events and receive notifications when they occur.

ResourceDescription

Represents an event in your online store.

Represents a specific webhook.

Getting started with webhooks in Commerce API

By carefully configuring and managing your endpoint, you ensure seamless communication with the Digital River Commerce API, allowing your application to react promptly to various store events.

Follow the detailed guide below to configure webhooks for your application using the Commerce API:

1. Request Webhook Service activation

Contact your CSM: Send a request to activate the Webhook Service to your Customer Success Manager (CSM). Include your site ID and company ID with your request. Your CSM will notify you when the Webhook service is enabled in Global Commerce.

2. Identify necessary events

Determine which events are vital for your application, ranging from subscription_created to inventory_changed.

3. Set up webhook subscriptions

  1. Add Digital River's IP addresses to your safelist to ensure you receive webhook notifications without issues. See the Commerce API safelist section for the list of IP addresses. We recommend you periodically check the Commerce API safelist for any changes to the list of IP addresses used for webhook notifications.

  2. With the Webhook Service activated, subscribe to the events via Global Commerce. Follow the steps in the Creating a webhook section for more details.

  3. Configure your application's endpoint URL to securely receive webhook notifications, ensuring it's set up to handle POST requests with the event data.

4. Handle webhook notifications

Implement appropriate logic within your application to process and acknowledge the received webhook notifications efficiently.

5. Test and validate

Perform comprehensive testing to ensure your application accurately responds to the webhook events. Validate the seamless data synchronization between your online store and the application.

By meticulously following these steps, you will ensure that your application remains responsive and up to date with the real-time data from your online store, thereby enhancing the customer experience.

Handling webhook event errors

It's crucial to implement error-handling mechanisms in your application to manage failed webhook events gracefully. Here are key strategies:

  • Retry logic: Implement a retry mechanism for temporary issues like network problems or server timeouts. Define a maximum number of retry attempts and exponential backoff intervals to avoid overwhelming the server.

  • Error logging: Log errors systematically to help with troubleshooting. Include timestamp, error type, and payload information for a comprehensive error context.

  • Notification system: Set up alerts for critical failures that require immediate attention. This ensures that you are promptly informed about issues that could impact the application's operation or data integrity.

  • Validate payloads: Ensure the integrity and authenticity of received payloads by validating them against a schema or checksum provided by the online store.

  • Feedback loop: Communicate persistent or critical issues back to the Digital River if possible. This can help resolve issues beyond the scope of retry logic or temporary fixes.

Last updated