---
title: "Authorization Reversal"
description: "Learn how to enable the Authorization Reversal feature in your Adyen Salesforce Order Management System package."
url: "https://docs.adyen.com/plugins/salesforce-order-management-system/authorization-reversal"
source_url: "https://docs.adyen.com/plugins/salesforce-order-management-system/authorization-reversal.md"
canonical: "https://docs.adyen.com/plugins/salesforce-order-management-system/authorization-reversal"
last_modified: "2023-11-30T12:04:00+01:00"
language: "en"
---

# Authorization Reversal

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

[View source](/plugins/salesforce-order-management-system/authorization-reversal.md)

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 fulfill the order. To use the feature, you make a request to the [Salesforce Payment Authorization Reversal Service API](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_commercepayments_rev_service_api.htm).

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](/online-payments/cancel/) in Adyen.

## Requirements

1. Have a fully functional Salesforce OMS Org that is connected to your [Salesforce Commerce Cloud (SFCC)](/plugins/salesforce-commerce-cloud) storefront.
2. [Install and set up the Adyen Salesforce OMS package](/plugins/salesforce-order-management-system/install-and-set-up-the-package) v3.1.0 or later.
3. Read the Salesforce documentation for the [Payment Authorization Reversal Service API](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_commercepayments_rev_service_api.htm).

## Step 1: Expose the Salesforce site endpoint

Adyen uses [webhooks](/development-resources/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

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](#expose-endpoint). To set up this webhook:

1. In your [Customer Area](https://ca-test.adyen.com/), 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](/plugins/salesforce-order-management-system/install-and-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](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_commercepayments_rev_service_api.htm) 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](https://help.salesforce.com/s/articleView?id=sf.om_order_payment_summary_fields.htm\&type=5).

## 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](#logs), but you get the final outcome from Adyen in a [webhook](#webhook).

### Monitor Salesforce logs

You can monitor [Salesforce Payment Gateway logs](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_paymentgatewaylog.htm) 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](/development-resources/webhooks) 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.

### Tab: success: true

```json
{
   "live":"false",
   "notificationItems":[
      {
         "NotificationRequestItem":{
            "amount":{
               "currency":"EUR",
               "value":500
            },
            "eventCode":"CANCELLATION",
            "eventDate":"2021-03-05T09:08:05+01:00",
            "merchantAccountCode":"YOUR_MERCHANT_ACCOUNT",
            "originalReference":"XB7XNCQ8HXSKGK82",
            "paymentMethod":"mc",
            "pspReference":"JDD6LKT8MBLZNN84",
            "reason":"",
            "success":"true"
         }
      }
   ]
}
```

### Tab: success: false

```json
{
   "live":"false",
   "notificationItems":[
      {
         "NotificationRequestItem":{
            "amount":{
               "currency":"EUR",
               "value":500
            },
            "eventCode":"CANCELLATION",
            "eventDate":"2021-03-05T09:08:05+01:00",
            "merchantAccountCode":"YOUR_MERCHANT_ACCOUNT",
            "originalReference":"XB7XNCQ8HXSKGK82",
            "paymentMethod":"mc",
            "pspReference":"JDD6LKT8MBLZNN84",
            "reason":"Transaction not found",
            "success":"false"
         }
      }
   ]
}
```

For more information about the included fields, see the [CANCELLATION](https://docs.adyen.com/api-explorer/Webhooks/latest/post/CANCELLATION) webhook reference.

In the event of a failed authorization reversal, you need to [manually reverse the authorization in your Adyen Customer Area](https://help.adyen.com/knowledge/payments/payment-statuses/how-do-i-cancel-a-payment).
