Requirements
- Have a fully functional Salesforce OMS Org that is connected to your Salesforce Commerce Cloud (SFCC) storefront.
- Install and set up the Adyen Salesforce OMS package v3.1.0 or later.
- Read the Salesforce documentation for the Payment Authorization Reversal Service API.
Step 1: Expose the Salesforce site endpoint
Adyen uses webhooks to inform you of changes to payment statuses. To receive these webhooks, expose your Salesforce site endpoint.- In your Salesforce Org, go to Setup.
- In the Quick Find box, search for User Interface.
- Under User Interface, go to Sites and Domains > Sites.
- Select the Adyen site. This opens the Site Details page.
- Select Public Access Settings. This opens the Public Access Settings page.
- Under Apps, select Apex Class Access.
- Select Edit.
- Under Available Apex Classes, select adyen_payment.NonPaymentWebhookHandler, and then select Add to move it to the Enabled Apex Classes list.
- Select Save.
Step 2: Configure webhooks in Adyen
If you are on Salesforce OMS 3.3.0 or later, you do not need to configure an additional webhook for Authorization Reversal. When our package processes the authorization reversal in Salesforce, you receive a CANCELLATION webhook that informs you of the outcome at the endpoint that you have exposed. To set up this webhook:- In your Customer Area, go to Developers > Webhooks. Switch to the merchant account that you use to process captures and refunds.
- Select **Webhook.
-
From the list of webhooks, next to Standard webhook, select Add.
This opens the configuration page for the standard webhook. -
Under General, configure the following:
-
Under Server configuration, configure the following:
-
Under Security, configure the following:
- Under Events, select CANCELLATION.
- Select Save configuration.
Step 3: Make an Authorization Reversal request
Follow the Salesforce documentation to learn about how to make a request using the Payment Authorization Reversal Service API. In your request, make sure that the value for theamount field you send in your request matches the Available to Capture amount that you see in the Order Payment Summary object.
Step 4: Get the outcome
After you make a request to reverse an authorization, our package processes the authorization reversal. You can monitor the status of your reversal request in the Salesforce logs, but you get the final outcome from Adyen in a webhook.Monitor Salesforce logs
You can monitor Salesforce Payment Gateway logs to stay informed on the status of your authorization reversal request. For an authorization reversal, thePaymentGatewayLog object contains:
InteractionType: AuthorizationReversalGatewayResultCode: informs you whether the authorization reversal succeeded or failed.
Get the Adyen webhook
You receive the final outcome of the authorization reversal request asynchronously, in a webhook that includes:-
eventCode: CANCELLATION. -
originalReference: the PSP reference of the authorization. -
success: whether the cancel request was successful. Possible values:- true: the cancel request was successful.
- false: the cancel request failed. The webhook event includes a
reasonfield with a short description of the problem. Review the reason, fix the issue if possible, and resubmit the cancel request.
- success: true
- success: false