{"title":"Authorization Reversal","category":"default","creationDate":1674038040,"content":"<p>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 <a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.apexcode.meta\/apexcode\/apex_commercepayments_rev_service_api.htm\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Salesforce Payment Authorization Reversal Service API<\/a>.<\/p>\n<p>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 <a href=\"\/pt\/online-payments\/cancel\/\">cancelling a payment<\/a> in Adyen.<\/p>\n<h2>Requirements<\/h2>\n<ol>\n<li>Have a fully functional Salesforce OMS Org that is connected to your <a href=\"\/pt\/plugins\/salesforce-commerce-cloud\">Salesforce Commerce Cloud (SFCC)<\/a> storefront.<\/li>\n<li><a href=\"\/pt\/plugins\/salesforce-order-management-system\/install-and-set-up-the-package\">Install and set up the Adyen Salesforce OMS package<\/a> v3.1.0 or later.<\/li>\n<li>Read the Salesforce documentation for the <a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.apexcode.meta\/apexcode\/apex_commercepayments_rev_service_api.htm\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Payment Authorization Reversal Service API<\/a>.<\/li>\n<\/ol>\n<h2 id=\"expose-endpoint\">Step 1: Expose the Salesforce site endpoint<\/h2>\n<p>Adyen uses <a href=\"\/pt\/development-resources\/webhooks\">webhooks<\/a> to inform you of changes to payment statuses. To receive these webhooks, expose your Salesforce site endpoint.<\/p>\n<ol>\n<li>In your Salesforce Org, go to <strong>Setup<\/strong>.<\/li>\n<li>In the <strong>Quick Find<\/strong> box, search for <strong>User Interface<\/strong>.<\/li>\n<li>Under <strong>User Interface<\/strong>, go to <strong>Sites and Domains<\/strong> &gt; <strong>Sites<\/strong>.<\/li>\n<li>Select the <strong>Adyen<\/strong> site. This opens the <strong>Site Details<\/strong> page.<\/li>\n<li>Select <strong>Public Access Settings<\/strong>. This opens the <strong>Public Access Settings<\/strong> page.<\/li>\n<li>Under <strong>Apps<\/strong>, select <strong>Apex Class Access<\/strong>.<\/li>\n<li>Select <strong>Edit<\/strong>.<\/li>\n<li>Under <strong>Available Apex Classes<\/strong>, select <strong>adyen_payment.NonPaymentWebhookHandler<\/strong>, and then select <strong>Add<\/strong> to move it to the <strong>Enabled Apex Classes<\/strong> list.<\/li>\n<li>Select <strong>Save<\/strong>.<\/li>\n<\/ol>\n<h2 id=\"configure-webhooks\">Step 2: Configure webhooks in Adyen<\/h2>\n<div class=\"sc-notice info\"><div>\n<p>If you are on Salesforce OMS 3.3.0 or later, you do not need to configure an additional webhook for Authorization Reversal.<\/p>\n<\/div><\/div>\n<p>When our package processes the authorization reversal in Salesforce, you receive a <strong>CANCELLATION<\/strong> webhook that informs you of the outcome at the <a href=\"#expose-endpoint\">endpoint that you have exposed<\/a>. To set up this webhook:<\/p>\n<ol>\n<li>\n<p>In your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>, go to <strong>Developers<\/strong>\u00a0&gt;\u00a0 <strong>Webhooks<\/strong>. Switch to the merchant account that you use to process captures and refunds.<\/p>\n<\/li>\n<li>\n<p>Select <i class=\"adl-icon-add\" role=\"img\" aria-label=\"add icon\"><\/i> <strong>Webhook<\/strong>.<\/p>\n<\/li>\n<li>\n<p>From the list of webhooks, next to <strong>Standard webhook<\/strong>, select <strong>Add<\/strong>.<br \/>\nThis opens the configuration page for the standard webhook.<\/p>\n<\/li>\n<li>\n<p>Under <strong>General<\/strong>, configure the following:<\/p>\n<table>\n<thead>\n<tr>\n<th>Setting<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>Enabled<\/strong><\/td>\n<td>Select the toggle to enable or disable the webhook.<\/td>\n<\/tr>\n<tr>\n<td><strong>Version<\/strong><\/td>\n<td>The webhook version.<\/td>\n<\/tr>\n<tr>\n<td><strong>Description<\/strong><\/td>\n<td>Your description of the webhook.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>\n<p>Under <strong>Server configuration<\/strong>, configure the following:<\/p>\n<table>\n<thead>\n<tr>\n<th>Setting<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>URL<\/strong><\/td>\n<td><strong>YOUR_SALESFORCE_SITE_URL\/adyen\/services\/apexrest\/adyen_payment\/nonPaymentWebhook\/v1<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>Method<\/strong><\/td>\n<td><strong>JSON<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>Encryption protocol<\/strong><\/td>\n<td>The latest <strong>TLS version<\/strong> in the list.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>\n<p>Under <strong>Security<\/strong>, configure the following:<\/p>\n<table>\n<thead>\n<tr>\n<th>Setting<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>HMAC Key<\/strong><\/td>\n<td>Enter your existing HMAC key that you generated when you <a href=\"\/pt\/plugins\/salesforce-order-management-system\/install-and-set-up-the-package\">set up the package<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>\n<p>Under <strong>Events<\/strong>, select <strong>CANCELLATION<\/strong>.<\/p>\n<\/li>\n<li>\n<p>Select <strong>Save configuration<\/strong>.<\/p>\n<\/li>\n<\/ol>\n<div class=\"notices green\">\n<p>Our package only supports cancelling the payment for the order in Salesforce. To cancel the order itself, you must implement your own logic.<\/p>\n<\/div>\n<h2 id=\"make-reversal-request\">Step 3: Make an Authorization Reversal request<\/h2>\n<p>Follow the <a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.apexcode.meta\/apexcode\/apex_commercepayments_rev_service_api.htm\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Salesforce documentation<\/a> to learn about how to make a request using the Payment Authorization Reversal Service API.<\/p>\n<p>In your request, make sure that the value for the <code>amount<\/code> field you send in your request matches the <strong>Available to Capture<\/strong> amount that you see in the <a href=\"https:\/\/help.salesforce.com\/s\/articleView?id=sf.om_order_payment_summary_fields.htm&amp;type=5\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Order Payment Summary object<\/a>.<\/p>\n<h2 id=\"get-the-outcome\">Step 4: Get the outcome<\/h2>\n<p>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 <a href=\"#logs\">Salesforce logs<\/a>, but you get the final outcome from Adyen in a <a href=\"#webhook\">webhook<\/a>.<\/p>\n<h3 id=\"logs\">Monitor Salesforce logs<\/h3>\n<p>You can monitor <a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.object_reference.meta\/object_reference\/sforce_api_objects_paymentgatewaylog.htm\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Salesforce Payment Gateway logs<\/a> to stay informed on the status of your authorization reversal request.<\/p>\n<p>For an authorization reversal, the <code>PaymentGatewayLog<\/code> object contains:<\/p>\n<ul>\n<li><code>InteractionType<\/code>: <strong>AuthorizationReversal<\/strong><\/li>\n<li><code>GatewayResultCode<\/code>: informs you whether the authorization reversal succeeded or failed.<\/li>\n<\/ul>\n<h3 id=\"webhook\">Get the Adyen webhook<\/h3>\n<p>You receive the final outcome of the authorization reversal request asynchronously, in a <a href=\"\/pt\/development-resources\/webhooks\">webhook<\/a> that includes:<\/p>\n<ul>\n<li><code>eventCode<\/code>: <strong>CANCELLATION<\/strong>.<\/li>\n<li><code>originalReference<\/code>: the PSP reference of the authorization.<\/li>\n<li>\n<p><code>success<\/code>: whether the cancel request was successful. Possible values:<\/p>\n<ul>\n<li><strong>true<\/strong>: the cancel request was successful.<\/li>\n<li><strong>false<\/strong>: the cancel request failed. The webhook event includes a <code>reason<\/code> field with a short description of the problem. Review the reason, fix the issue if possible, and resubmit the cancel request.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n<div id=\"tab1QzU7\">\n    <div data-component-wrapper=\"tabs\">\n        <tabs\n                        :items=\"[{&quot;title&quot;:&quot;success: true&quot;,&quot;content&quot;:&quot;\\n&lt;pre&gt;&lt;code class=\\&quot;language-json\\&quot;&gt;{\\n   \\&quot;live\\&quot;:\\&quot;false\\&quot;,\\n   \\&quot;notificationItems\\&quot;:[\\n      {\\n         \\&quot;NotificationRequestItem\\&quot;:{\\n            \\&quot;amount\\&quot;:{\\n               \\&quot;currency\\&quot;:\\&quot;EUR\\&quot;,\\n               \\&quot;value\\&quot;:500\\n            },\\n            \\&quot;eventCode\\&quot;:\\&quot;CANCELLATION\\&quot;,\\n            \\&quot;eventDate\\&quot;:\\&quot;2021-03-05T09:08:05+01:00\\&quot;,\\n            \\&quot;merchantAccountCode\\&quot;:\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n            \\&quot;originalReference\\&quot;:\\&quot;XB7XNCQ8HXSKGK82\\&quot;,\\n            \\&quot;paymentMethod\\&quot;:\\&quot;mc\\&quot;,\\n            \\&quot;pspReference\\&quot;:\\&quot;JDD6LKT8MBLZNN84\\&quot;,\\n            \\&quot;reason\\&quot;:\\&quot;\\&quot;,\\n            \\&quot;success\\&quot;:\\&quot;true\\&quot;\\n         }\\n      }\\n   ]\\n}&lt;\\\/code&gt;&lt;\\\/pre&gt;\\n&quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:&quot;success:_true_0_1&quot;,&quot;relation&quot;:&quot;&quot;},{&quot;title&quot;:&quot;success: false&quot;,&quot;content&quot;:&quot;\\n&lt;pre&gt;&lt;code class=\\&quot;language-json\\&quot;&gt;{\\n   \\&quot;live\\&quot;:\\&quot;false\\&quot;,\\n   \\&quot;notificationItems\\&quot;:[\\n      {\\n         \\&quot;NotificationRequestItem\\&quot;:{\\n            \\&quot;amount\\&quot;:{\\n               \\&quot;currency\\&quot;:\\&quot;EUR\\&quot;,\\n               \\&quot;value\\&quot;:500\\n            },\\n            \\&quot;eventCode\\&quot;:\\&quot;CANCELLATION\\&quot;,\\n            \\&quot;eventDate\\&quot;:\\&quot;2021-03-05T09:08:05+01:00\\&quot;,\\n            \\&quot;merchantAccountCode\\&quot;:\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n            \\&quot;originalReference\\&quot;:\\&quot;XB7XNCQ8HXSKGK82\\&quot;,\\n            \\&quot;paymentMethod\\&quot;:\\&quot;mc\\&quot;,\\n            \\&quot;pspReference\\&quot;:\\&quot;JDD6LKT8MBLZNN84\\&quot;,\\n            \\&quot;reason\\&quot;:\\&quot;Transaction not found\\&quot;,\\n            \\&quot;success\\&quot;:\\&quot;false\\&quot;\\n         }\\n      }\\n   ]\\n}&lt;\\\/code&gt;&lt;\\\/pre&gt;\\n&quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:&quot;success:_false_1_2&quot;,&quot;relation&quot;:&quot;&quot;}]\"\n            :should-update-when-url-changes='false'>\n        <\/tabs>\n    <\/div>\n<\/div>\n\n<p>For more information about the included fields, see the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Webhooks\/latest\/post\/CANCELLATION\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CANCELLATION<\/a> webhook reference.<\/p>\n<p>In the event of a failed authorization reversal, you need to <a href=\"https:\/\/help.adyen.com\/knowledge\/payments\/payment-statuses\/how-do-i-cancel-a-payment\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">manually reverse the authorization in your Adyen Customer Area<\/a>.<\/p>","url":"https:\/\/docs.adyen.com\/pt\/plugins\/salesforce-order-management-system\/authorization-reversal","articleFields":{"description":"Learn how to enable the Authorization Reversal feature in your Adyen Salesforce Order Management System package.","feedback_component":true,"last_edit_on":"30-11-2023 12:04","filters_component":false,"page_id":"39341360-00c7-41e5-8fd4-8a3cae646d5d"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/plugins\/salesforce-order-management-system\/authorization-reversal","title":"Authorization Reversal","content":"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.\nYou 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.\nRequirements\n\nHave a fully functional Salesforce OMS Org that is connected to your Salesforce Commerce Cloud (SFCC) storefront.\nInstall and set up the Adyen Salesforce OMS package v3.1.0 or later.\nRead the Salesforce documentation for the Payment Authorization Reversal Service API.\n\nStep 1: Expose the Salesforce site endpoint\nAdyen uses webhooks to inform you of changes to payment statuses. To receive these webhooks, expose your Salesforce site endpoint.\n\nIn your Salesforce Org, go to Setup.\nIn the Quick Find box, search for User Interface.\nUnder User Interface, go to Sites and Domains &gt; Sites.\nSelect the Adyen site. This opens the Site Details page.\nSelect Public Access Settings. This opens the Public Access Settings page.\nUnder Apps, select Apex Class Access.\nSelect Edit.\nUnder Available Apex Classes, select adyen_payment.NonPaymentWebhookHandler, and then select Add to move it to the Enabled Apex Classes list.\nSelect Save.\n\nStep 2: Configure webhooks in Adyen\n\nIf you are on Salesforce OMS 3.3.0 or later, you do not need to configure an additional webhook for Authorization Reversal.\n\nWhen 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:\n\n\nIn your Customer Area, go to Developers\u00a0&gt;\u00a0 Webhooks. Switch to the merchant account that you use to process captures and refunds.\n\n\nSelect  Webhook.\n\n\nFrom the list of webhooks, next to Standard webhook, select Add.\nThis opens the configuration page for the standard webhook.\n\n\nUnder General, configure the following:\n\n\n\nSetting\nDescription\n\n\n\n\nEnabled\nSelect the toggle to enable or disable the webhook.\n\n\nVersion\nThe webhook version.\n\n\nDescription\nYour description of the webhook.\n\n\n\n\n\nUnder Server configuration, configure the following:\n\n\n\nSetting\nDescription\n\n\n\n\nURL\nYOUR_SALESFORCE_SITE_URL\/adyen\/services\/apexrest\/adyen_payment\/nonPaymentWebhook\/v1\n\n\nMethod\nJSON\n\n\nEncryption protocol\nThe latest TLS version in the list.\n\n\n\n\n\nUnder Security, configure the following:\n\n\n\nSetting\nDescription\n\n\n\n\nHMAC Key\nEnter your existing HMAC key that you generated when you set up the package.\n\n\n\n\n\nUnder Events, select CANCELLATION.\n\n\nSelect Save configuration.\n\n\n\nOur package only supports cancelling the payment for the order in Salesforce. To cancel the order itself, you must implement your own logic.\n\nStep 3: Make an Authorization Reversal request\nFollow the Salesforce documentation to learn about how to make a request using the Payment Authorization Reversal Service API.\nIn 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.\nStep 4: Get the outcome\nAfter 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.\nMonitor Salesforce logs\nYou can monitor Salesforce Payment Gateway logs to stay informed on the status of your authorization reversal request.\nFor an authorization reversal, the PaymentGatewayLog object contains:\n\nInteractionType: AuthorizationReversal\nGatewayResultCode: informs you whether the authorization reversal succeeded or failed.\n\nGet the Adyen webhook\nYou receive the final outcome of the authorization reversal request asynchronously, in a webhook that includes:\n\neventCode: CANCELLATION.\noriginalReference: the PSP reference of the authorization.\n\nsuccess: whether the cancel request was successful. Possible values:\n\ntrue: the cancel request was successful.\nfalse: 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.\n\n\n\n\n\n    \n        \n        \n    \n\n\nFor more information about the included fields, see the  CANCELLATION webhook reference.\nIn the event of a failed authorization reversal, you need to manually reverse the authorization in your Adyen Customer Area.","type":"page","locale":"pt","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Plugins","lvl2":"Salesforce Order Management System","lvl3":"Authorization Reversal"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/plugins","lvl2":"https:\/\/docs.adyen.com\/pt\/plugins\/salesforce-order-management-system","lvl3":"\/pt\/plugins\/salesforce-order-management-system\/authorization-reversal"},"levels":4,"category":"Plugins","category_color":"green","tags":["Authorization","Reversal"]}}
