Reverse an Authorized Payment {#thunes-reversal-intro}
======================================================

The authorization-reversal request enables you to reverse a transaction's authorized amount. You may need to reverse an authorized payment when either you or the customer decide to cancel a payment. Requesting an authorization-reversal requires the requestID from the authorization response.

Calculating the Grand Total
---------------------------

Include the grand total in the request by using the purchaseTotals_grandTotalAmount field.  
For information about how to calculate the grand total, see [Calculating the Grand Total for Line Items](/docs/cybs/en-us/thunes/developer/all/so/thunes/thunes-ref-info/thunes-intro-total.md "").

Endpoints {#thunes-reversal-intro_section_ebq_l24_jyb}
------------------------------------------------------

Set the apAuthReversalService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`

Response Statuses
-----------------

The authorization-reversal service responds with one of these statuses as the apAuthReversalReply_status field value:

* `AUTH_REVERSED`: The authorization is successfully reversed.
* `FAILED`: The authorization-reversal failed.

{#thunes-reversal-intro_ul_l2g_sm1_cyb}The authorization-reversal service also responds with a reason code as the apAuthReversalreply_reasonCode field value.  
For more information on reason codes, see the [Reason Codes for the Simple Order API](https://developer.cybersource.com/docs/cybs/en-us/reason-codes-so/reference/all/so/reason-codes-so/reason-codes-so.md "").

Required Fields for Reversing an Authorized Payment {#thunes-reversal-req-fields}
=================================================================================

Include these required fields to reverse an authorization.

[apAuthReversalService_authRequestID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-auth-reversal-service-auth-request-id.md "")
:
Set the field value to the request ID included in the authorization response.

[apAuthReversalService_run](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-auth-reversal-service-run.md "")
:
Set the field value to `true`.

[apPaymentType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-payment-type.md "")
:
Set the field value to `ONY`.

[merchantID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-id.md "")
:

[merchantReferenceCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-reference-code.md "")
:

[purchaseTotals_currency](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-currency.md "")
:
Set to `EUR`.

[purchaseTotals_grandTotalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-grand-total-amount.md "")
:
{#thunes-reversal-req-fields_dl_g32_35x_yxb}

`Simple Order API` Example: Reversing an Authorized Payment {#thunes-reversal-ex-so}
====================================================================================

Request

```
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
	&lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
	&lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
	&lt;purchaseTotals&gt;
		&lt;currency&gt;EUR&lt;/currency&gt;
		&lt;grandTotalAmount&gt;220&lt;/grandTotalAmount&gt;
	&lt;/purchaseTotals&gt;
	&lt;apPaymentType&gt;ONY&lt;/apPaymentType&gt;
	&lt;apAuthReversalService run="true"&gt;
		&lt;authRequestID&gt;6953229325326859903007&lt;/authRequestID&gt;
	&lt;/apAuthReversalService&gt;
&lt;/requestMessage&gt;
```

Response to a Successful Request

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
	&lt;merchantReferenceCode&gt;ref1695323540&lt;/merchantReferenceCode&gt;
	&lt;requestID&gt;6953235404876719203008&lt;/requestID&gt;
	&lt;decision&gt;ACCEPT&lt;/decision&gt;
	&lt;reasonCode&gt;100&lt;/reasonCode&gt;
	&lt;requestToken&gt;AxjnrwSTeO+GiOpSQiLAANgZYjWmdmbQg1aUaGojmiHA8v0h9XwMwIZNJMvRiy0P/Sbx3v0EGI7a+MYAsACd&lt;/requestToken&gt;
	&lt;purchaseTotals&gt;
		&lt;currency&gt;EUR&lt;/currency&gt;
	&lt;/purchaseTotals&gt;
	&lt;apAuthReversalReply&gt;
		&lt;reasonCode&gt;100&lt;/reasonCode&gt;
		&lt;status&gt;AUTH_REVERSED&lt;/status&gt;
		&lt;processorResponse&gt;00007&lt;/processorResponse&gt;
		&lt;amount&gt;220.00&lt;/amount&gt;
		&lt;dateTime&gt;2023-09-21T19:12:26Z&lt;/dateTime&gt;
		&lt;paymentStatus&gt;auth_reversed&lt;/paymentStatus&gt;
		&lt;responseCode&gt;00007&lt;/responseCode&gt;
		&lt;reconciliationID&gt;XFZ3YMPAURFC&lt;/reconciliationID&gt;
	&lt;/apAuthReversalReply&gt;
&lt;/replyMessage&gt;
```

