Extend the App Webhook Framework
Learn how to extend the App Webhook Framework.
The Salesforce B2B Commerce—Digital River Connector App comes with a Webhook framework that is capable of accepting and consuming any webhook that can be configured in the DR Dashboard. OOTB (Out of the box), the App currently provides an implementation for the Webhook events order.accepted
, order.complete
and order.invoice.created
. You can always extend this framework to implement custom code that will fire upon receipt of a Webhook from Digital River.
Extend the webhook framework
To implement custom business logic for your Organization, you can write subscriber code that extends the default Webhook Framework Extension point class digitalriverv2.DRB2B_WebhookHandler
.
For example, suppose you want to implement custom business logic for the event refund.pending
:
In your Organization, create an Apex class that extends the extension point class
digitalriverv2.DRB2B_WebhookHandler
global with sharing class DRB2B_RefundPendingWebhook extends digitalriverv2.DRB2B_WebhookHandler { }Inside the class definition, override the method processWebhookEvent of the extension point class
digitalriverv2.DRB2B_WebhookHandler
. This method will have the Event Payload as one of its Input parameters.Inside your method override, add your custom business logic. Make sure the RestResponse status code is set to 200 as shown in the sample implementation for the
refund.pending
webhook event below.Save your class and resolve any compilation errors.
Your Apex class needs to be configured so that the Connector is aware and executes this Custom Webhook handler implementation whenever it receives the event
refund.pending
from Digital River.Create a new Metadata Type Record for DR Webhook Configuration.
Label: Refund Pending Webhook Handler Name.
DR Webhook Configuration Name:
Refund_Pending_Webhook_Handler_Name
.Config Name:
refund.pending
(This is the Event Type).Config Value: DRB2B_RefundPendingWebhook (this will be the Custom Class Name).
Set up the Webhook for the Event Type
refund.pending
in Digital River Dashboard.Log in to the Digital River Dashboard.
Last updated