Plugins-2 icon

Authorization Reversal

Learn how to enable the Authorization Reversal feature in your Adyen Salesforce Order Management System package.

Authorization Reversal is a Salesforce feature that enables you to release the reserved authorization amount on a shopper's card, for example when you can no longer fulfil the order. To use the feature, you make a request to the Salesforce Payment Authorization Reversal Service API.

You can enable Authorization Reversal with our OMS package to handle the request in the back-end and process the reversal. An Authorization Reversal in Salesforce is equivalent to cancelling a payment in Adyen.

Requirements

  1. Have a fully functional Salesforce OMS Org that is connected to your Salesforce Commerce Cloud (SFCC) storefront.
  2. Install and set up the Adyen Salesforce OMS package v3.1.0 or later.
  3. 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.

  1. In your Salesforce Org, go to Setup.
  2. In the Quick Find box, search for User Interface.
  3. Under User Interface, go to Sites and Domains > Sites.
  4. Select the Adyen site. This opens the Site Details page.
  5. Select Public Access Settings. This opens the Public Access Settings page.
  6. Under Apps, select Apex Class Access.
  7. Select Edit.
  8. Under Available Apex Classes, select adyen_payment.NonPaymentWebhookHandler, and then select Add to move it to the Enabled Apex Classes list.
  9. Select Save.

Step 2: Configure webhooks in Adyen

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:

  1. In your Customer Area, go to Developers >  Webhooks. Switch to the merchant account that you use to process captures and refunds.

  2. Select Webhook.

  3. From the list of webhooks, next to Standard webhook, select Add.
    This opens the configuration page for the standard webhook.

  4. Under General, configure the following:

    Setting Description
    Enabled Select the toggle to enable or disable the webhook.
    Version The webhook version.
    Description Your description of the webhook.
  5. Under Server configuration, configure the following:

    Setting Description
    URL YOUR_SALESFORCE_SITE_URL/adyen/services/apexrest/adyen_payment/nonPaymentWebhook/v1
    Method JSON
    Encryption protocol The latest TLS version in the list.
  6. Under Security, configure the following:

    Setting Description
    HMAC Key Enter your existing HMAC key that you generated when you set up the package.
  7. Under Events, select CANCELLATION.

  8. Select Save configuration.

Our package only supports cancelling the payment for the order in Salesforce. To cancel the order itself, you must implement your own logic.

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 the amount 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, the PaymentGatewayLog object contains:

  • InteractionType: AuthorizationReversal
  • GatewayResultCode: 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 reason field with a short description of the problem. Review the reason, fix the issue if possible, and resubmit the cancel request.

For more information about the included fields, see the CANCELLATION webhook reference.

In the event of a failed authorization reversal, you need to manually reverse the authorization in your Adyen Customer Area.