--- title: "Referenced refunds" description: "Enable omnichannel returns with simple reconciliation and better fraud protection." url: "https://docs.adyen.com/unified-commerce/referenced-refunds" source_url: "https://docs.adyen.com/unified-commerce/referenced-refunds.md" canonical: "https://docs.adyen.com/unified-commerce/referenced-refunds" last_modified: "2022-02-01T14:06:00+01:00" language: "en" --- # Referenced refunds Enable omnichannel returns with simple reconciliation and better fraud protection. [View source](/unified-commerce/referenced-refunds.md) Customers appreciate the possibility of omnichannel returns, allowing them to return an ecommerce purchase to a physical store, or return their in-store purchase by sending it to your distribution center. With referenced refunds, you can offer omnichannel returns with a minimum of operational burden. Referenced refunds are *not* processed synchronously. When you send an API request for a referenced refund, the API response only confirms we received the request. We process the refund asynchronously, and inform you of the result through a [webhook](#refund-webhook). Refunded amounts are deducted from the [in-process funds](https://help.adyen.com/knowledge/payments/refunds/what-funds-do-i-have-available-for-refunds) of the merchant account that processed the original payment. For example, if a sale took place on MerchantAccount\_ECOM and the product is returned to MerchantAccount\_POS, the funds are taken from the ECOM account. ## Requirements | Requirement | Description | | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | An [online payments integration](/online-payments/build-your-integration/) and an [in-person payments integration](/point-of-sale/what-we-support/solutions/). | | **[Webhooks](/development-resources/webhooks)** | Subscribe to Standard webhooks. | | **Setup steps** | Before you begin:- [Synchronize your back-end systems](#synchronize-your-back-end-systems). - Ask our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to enable refunds on the company level. | ### Synchronize your back-end systems A requirement for omnichannel returns is that you have access to transaction information of all sales channels. For referenced refunds, this transaction information must include the PSP reference. Ideally you have a central database where you store information from both ecommerce and point-of-sale transactions. If you store the ecommerce and point-of-sale transaction information separately on different systems, these systems must be able read each other's data. ### Enable on the company level To process returns between multiple merchant accounts, in this case omnichannel returns between ecommerce and point-of-sale merchants accounts, you need to contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to enable refunds on the company level. You can then use the [/payments/{paymentPspReference}/refunds](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds) endpoint to submit returns for any merchant account under your company account. ## Benefits Omnichannel referenced refunds offer the following benefits. * **Simpler reconciliation**\ On our unified payments platform we assign a unique identifier to each transaction. This identifier is known as the *PSP reference*. When you issue a referenced refund, you specify the PSP reference of the original payment. In this way, you can match each refund against a payment, regardless of the sales channel. You have the complete audit trail of a payment including any full or partial refunds. * **Better fraud protection**\ A referenced refund returns the funds to the payment method that was used for the original payment, not to the card the shopper is presenting in the store or as cash. This helps combat various return fraud types like returning stolen merchandise, receipt fraud, and cross-retailer returns. * **Never more than 100%**\ When using referenced refunds, payments cannot be refunded multiple times, or for an amount exceeding 100% of the payment value. ## Refund authorization Refund authorization means that before processing a refund, Adyen checks with the issuer if the shopper's card or account is valid. This happens automatically; you do not have to ask for this in your refund request. Adyen supports this for: * American Express * Discover * Mastercard * Visa As soon as the issuer authorizes the refund, the refund is visible on the shopper's account. This improves customer satisfaction and reduces the number of questions from shoppers about their refund. Also, there are less refund-related chargebacks because issuers usually return the funds to the shopper sooner. Issuers can decline a refund authorization for reasons like: * Lost or expired card * Invalid card number * Closed account * Suspected fraud When a refund authorization is declined, we still try to process the refund. ### Pilot to prepare for 2026 changes Adyen is currently running a pilot where declined refund authorizations are handled differently: * We do not proceed with the refund. In your Customer Area, the transaction status remains **Settled**. * We inform you of the reason for the declined refund authorization in the **REFUND**, **CANCEL\_OR\_REFUND**, and **REFUND\_WITH\_DATA** webhooks. The `reason` parameter in the webhook will a have a value of *Authorisation for refund failed with response code* followed by the [raw response](/development-resources/raw-acquirer-responses/) we received. **Reason for failed refund authorization in REFUND webhook** ```json { ... { "NotificationRequestItem": { ... "eventCode": "REFUND", "reason": "Authorisation for refund failed with response code 46 : Closed account", "success": "false" } } ] } ``` This improved transparency about the status of a refund enables you to take action sooner, so you can return the funds to the shopper in some other way. The behavior described above will become the default in 2026. If you want to prepare for that and participate in this pilot, reach out to your Adyen contact or to our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other). Note that some card networks charge a refund authorization fee. ## Refund options To issue a full or partial referenced refund, you have these options: * [Terminal API reversal request](#reversal-request): your POS app sends a Terminal API `ReversalRequest` to the payment terminal. The request includes the PSP reference of the original point-of-sale or ecommerce purchase. The terminal generates a receipt, and the funds are returned to the original card or other payment method without the need for the customer to present a card to the payment terminal. * [Server-to-server refund](#refunds-endpoint): you make a POST request to the `/payments/{paymentPspReference}/refunds` endpoint, where `paymentPspReference` is the PSP reference of the original point-of-sale or ecommerce purchase. * [Refund from your Customer Area](/account/manage-payments#refund-a-payment): this is a good option if you do not issue refunds often. We describe this in the *Account* section of our documentation. ## Send a Terminal API reversal request When you make a POS payment, the Terminal API response returns the [transaction identifier](/point-of-sale/design-your-integration/terminal-api#response-body) of the payment in the format `tenderReference.pspReference`. To make a referenced refund, you specify this transaction identifier in your refund request. However, the `tenderReference` is generated by the payment terminal, and is missing for an ecommerce payment. In that case you include only the PSP reference, in the format `.pspReference`. You can make a: * **Full refund** to return the total value of the purchase to the shopper. * **Partial refund** to return part of the purchase to the shopper. For example, when a shopper returns one of the items they purchased. You can also make multiple partial refunds. For example, when a shopper returns several items at different times. Select a tab to see the parameters that you need to specify for a full referenced refund, or a partial referenced refund. ### Tab: Full refund Here we describe the **basic** referenced refund request for the full amount. To [refund an ecommerce payment](#refund-ecommerce-payment), the request is a little different. 1. Get the `TransactionID` and the `TimeStamp` of the original payment. You received these values in the payment response, in the `POIData.POITransactionID` object. 2. Make a POST request to a [Terminal API endpoint](/point-of-sale/design-your-integration/terminal-api#endpoints), specifying: * The standard [`SaleToPOIRequest.MessageHeader` ](/point-of-sale/design-your-integration/terminal-api#request-message-header)object, with `MessageClass` set to **Service** and `MessageCategory` set to **Reversal**. | Parameter | Required | Description | | ----------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ProtocolVersion` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **3.0** | | `MessageClass` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Service** | | `MessageCategory` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Reversal** | | `MessageType` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Request** | | `ServiceID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal (`POIID`) being used. | | `SaleID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for the POS system component to send this request from. | | `POIID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The unique ID of the terminal to send this request to. Format: *\[device model]-\[serial number]*. | * The [ReversalRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/reversal) object with: | Parameter | Required | Description | | ----------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `OriginalPOITransaction.POITransactionID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with:- `TransactionID`: Transaction identifier of the original payment in the format `tenderReference.pspReference`. For example, **BV0q001643892070000.VK9DRSLLRCQ2WN82** - `TimeStamp`: Date and time in [UTC format](https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_\(UTC\)) of the original payment. For example, **2000-01-01T00:00:00.000Z** | | `ReversalReason` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to **MerchantCancel**. | The following example shows how to make a full referenced refund. #### JSON ```json { "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"Reversal", "MessageType":"Request", "SaleID":"POSSystemID12345", "ServiceID":"0207111105", "POIID":"V400m-324688179" }, "ReversalRequest":{ "OriginalPOITransaction":{ "POITransactionID":{ "TransactionID":"BV0q001643892070000.VK9DRSLLRCQ2WN82", "TimeStamp":"2022-01-31T12:08:45.004Z" } }, "ReversalReason":"MerchantCancel" } } } ``` #### Java ```java String saleID = "YOUR_CASH_REGISTER_ID"; String serviceID = "YOUR_UNIQUE_ATTEMPT_ID"; String POIID = "YOUR_TERMINAL_ID"; String transactionID = "YOUR_UNIQUE_TRANSACTION_ID"; SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest(); MessageHeader messageHeader = new MessageHeader(); messageHeader.setProtocolVersion("3.0"); messageHeader.setMessageClass( MessageClassType.SERVICE ); messageHeader.setMessageCategory( MessageCategoryType.REVERSAL ); messageHeader.setMessageType( MessageType.REQUEST ); messageHeader.setSaleID(saleID); messageHeader.setServiceID(serviceID); messageHeader.setPOIID(POIID); saleToPOIRequest.setMessageHeader(messageHeader); ReversalRequest reversalRequest = new ReversalRequest(); OriginalPOITransaction originalPOITransaction = new OriginalPOITransaction(); TransactionIdentification pOITransactionID = new TransactionIdentification(); pOITransactionID.setTransactionID(transactionID); pOITransactionID.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar())); originalPOITransaction.setPOITransactionID(pOITransactionID); reversalRequest.setOriginalPOITransaction(originalPOITransaction); reversalRequest.setReversalReason( ReversalReasonType.MERCHANT_CANCEL ); saleToPOIRequest.setReversalRequest(reversalRequest); terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest); ``` The payment terminal shows a waiting screen until you receive the response.\ ![](/user/pages/docs/06.unified-commerce/10.referenced-refunds/WaitingScreen.png) 3. When you receive the [ReversalResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/reversal/#responses-200), note the following: | Parameter | Description | | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Response.Result` | **Success** means we received your request. The refund itself will be processed asynchronously. | | `POIData.POITransactionID.TransactionID` | The PSP reference for this refund request. | | `PaymentReceipt` | The generated receipt data. This includes **REFUND REQUESTED**. | | `Response.AdditionalResponse` | This includes:- `posOriginalAmountValue`: The amount (in [minor units](/development-resources/currency-codes)) of the original payment. - `posAuthAmountValue`: The refund amount (in minor units) that we will try to get authorized. - `pspReference`: The PSP reference for this refund request. | **Response when we received your full reversal request** ```json { "SaleToPOIResponse": { "MessageHeader": { "MessageCategory": "Reversal", "MessageClass": "Service", "MessageType": "Response", "POIID": "V400m-324688179", "ProtocolVersion": "3.0", "SaleID": "POSSystemID12345", "ServiceID": "207111107" }, "ReversalResponse": { "POIData": { "POITransactionID": { "TimeStamp": "2022-02-03T15:04:15.004Z", "TransactionID": "TF995R5G6L2GWR82" } }, "PaymentReceipt": [...], "Response": { "AdditionalResponse": "tid=47069832&transactionType=GOODS_SERVICES&posadditionalamounts.originalAmountValue=1025&giftcardIndicator=false&posAmountGratuityValue=0&pspReference=TF995R5G6L2GWR82&store=YOUR_STOREL&iso8601TxDate=2022-02-03T15%3a04%3a13.0000000%2b0000&posOriginalAmountValue=1025&txtime=16%3a04%3a13&paymentMethod=mc&txdate=03-02-2022&merchantReference=2022-02-03%2016%3a04%3a13&posadditionalamounts.originalAmountCurrency=EUR&transactionReferenceNumber=TF995R5G6L2GWR82&posAuthAmountCurrency=EUR&posAmountCashbackValue=0&posEntryMode=CLESS_CHIP&posAuthAmountValue=1025", "Result": "Success" } } } } ``` If your request failed, the [ReversalResponse.Response](https://docs.adyen.com/api-explorer/terminal-api/latest/post/reversal/#responses-200-Response) contains: * `Result`: **Failure** * `AdditionalResponse`: This includes a `message` explaining why the request failed. For example: * *Original pspReference required for this operation*: Messages like this tell you how to fix the request so you can try again. * *Transaction is already voided*: This message tells you that we already received a full reversal request for the original transaction. 4. Wait for the [CANCEL\_OR\_REFUND webhook](#cancel-or-refund-webhook) to learn the outcome. Refunds are always processed asynchronously. If successful, the refund is issued to the shopper's account. ### Tab: Partial refund Here we describe the **basic** referenced refund request for a partial amount. To [refund an ecommerce payment](#refund-ecommerce-payment), the request is a little different. 1. Get the `TransactionID` and the `TimeStamp` of the original payment. You received these values in the payment response, in the `POIData.POITransactionID` object. 2. Make a POST request to a [Terminal API endpoint](/point-of-sale/design-your-integration/terminal-api#endpoints), specifying: * The standard [`SaleToPOIRequest.MessageHeader` ](/point-of-sale/design-your-integration/terminal-api#request-message-header)object, with `MessageClass` set to **Service** and `MessageCategory` set to **Reversal**. | Parameter | Required | Description | | ----------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ProtocolVersion` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **3.0** | | `MessageClass` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Service** | | `MessageCategory` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Reversal** | | `MessageType` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Request** | | `ServiceID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal (`POIID`) being used. | | `SaleID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for the POS system component to send this request from. | | `POIID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The unique ID of the terminal to send this request to. Format: *\[device model]-\[serial number]*. | * The [ReversalRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/reversal) object with: | Parameter | Required | Description | | ----------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `OriginalPOITransaction.POITransactionID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with:- `TransactionID`: Transaction identifier of the original payment in the format `tenderReference.pspReference`. For example, **BV0q001643892070000.VK9DRSLLRCQ2WN82** - `TimeStamp`: date and time in [UTC format](https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_\(UTC\)) of the original payment. For example, **2000-01-01T00:00:00.000Z** | | `ReversalReason` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to **MerchantCancel**. | | `ReversedAmount` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The amount (provided as a number, not a string) being returned to the shopper in the partial refund. Must be smaller than or equal to the initial payment amount. | | `SaleData.SaleToAcquirerData` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The currency of the refund, in the format `currency=ABC` where `ABC` is the three-letter [currency code](/development-resources/currency-codes). This must match the currency of the original payment. | | `SaleData.SaleTransactionID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with:- `TransactionID`: your reference for the refund. In your Customer Area and Adyen reports, this will show as the **merchant reference**. - `TimeStamp`: date and time in [UTC format](https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_\(UTC\)) of the refund. | The following example shows how to make a partial referenced refund of EUR 6.00. #### JSON ```json { "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"Reversal", "MessageType":"Request", "SaleID":"POSSystemID12345", "ServiceID":"207111108", "POIID":"V400m-324688179" }, "ReversalRequest":{ "OriginalPOITransaction":{ "POITransactionID":{ "TransactionID":"BV0q001643892070000.VK9DRSLLRCQ2WN82", "TimeStamp":"2022-01-31T12:08:45.004Z" } }, "ReversalReason":"MerchantCancel", "ReversedAmount":6.00, "SaleData":{ "SaleToAcquirerData":"currency=EUR", "SaleTransactionID":{ "TimeStamp":"2022-02-03T15:04:14.004Z", "TransactionID":"rev-708" } } } } } ``` #### Java ```java String saleID = "YOUR_CASH_REGISTER_ID"; String serviceID = "YOUR_UNIQUE_ATTEMPT_ID"; String POIID = "YOUR_TERMINAL_ID"; String transactionID = "YOUR_UNIQUE_TRANSACTION_ID"; SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest(); MessageHeader messageHeader = new MessageHeader(); messageHeader.setProtocolVersion("3.0"); messageHeader.setMessageClass( MessageClassType.SERVICE ); messageHeader.setMessageCategory( MessageCategoryType.REVERSAL ); messageHeader.setMessageType( MessageType.REQUEST ); messageHeader.setSaleID(saleID); messageHeader.setServiceID(serviceID); messageHeader.setPOIID(POIID); saleToPOIRequest.setMessageHeader(messageHeader); ReversalRequest reversalRequest = new ReversalRequest(); OriginalPOITransaction originalPOITransaction = new OriginalPOITransaction(); TransactionIdentification pOITransactionID = new TransactionIdentification(); pOITransactionID.setTransactionID(transactionID); pOITransactionID.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar())); originalPOITransaction.setPOITransactionID(pOITransactionID); reversalRequest.setOriginalPOITransaction(originalPOITransaction); reversalRequest.setReversalReason( ReversalReasonType.MERCHANT_CANCEL ); reversalRequest.setReversedAmount(6.0); SaleData saleData = new SaleData(); saleData.setSaleToAcquirerData("currency=EUR"); TransactionIdentification saleTransactionID = new TransactionIdentification(); saleTransactionID.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar())); saleTransactionID.setTransactionID(transactionID); saleData.setSaleTransactionID(saleTransactionID); reversalRequest.setSaleData(saleData); saleToPOIRequest.setReversalRequest(reversalRequest); terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest); ``` The payment terminal shows a waiting screen until you receive the response.\ ![](/user/pages/docs/06.unified-commerce/10.referenced-refunds/WaitingScreen.png) 3. When you receive the [ReversalResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/reversal/#responses-200) note the following: | Parameter | Description | | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Response.Result` | **Success** means we received your request. The refund itself will be processed asynchronously. | | `Response.ReversedAmount` | The partial refund amount that we will try to get authorized. | | `POIData.POITransactionID.TransactionID` | The PSP reference for this refund request. | | `PaymentReceipt` | The generated receipt data. This includes **REFUND REQUESTED**. | | `Response.AdditionalResponse` | This includes:- `posOriginalAmountValue`: The amount (in [minor units](/development-resources/currency-codes)) of the original payment. - `posAuthAmountValue`: The refund amount (in minor units) that we will try to get authorized. - `merchantReference`: The `SaleData.SaleTransactionID.TransactionID` from the partial refund request. - `pspReference`: The PSP reference for this refund request. | **Response when we received your partial reversal request** ```json { "SaleToPOIResponse": { "MessageHeader": { "MessageCategory": "Reversal", "MessageClass": "Service", "MessageType": "Response", "POIID": "V400m-324688179", "ProtocolVersion": "3.0", "SaleID": "POSSystemID12345", "ServiceID": "207111107" }, "ReversalResponse": { "POIData": { "POITransactionID": { "TimeStamp": "2022-02-03T15:04:15.004Z", "TransactionID": "TF995R5G6L2GWR82" } }, "PaymentReceipt": [...], "Response": { "AdditionalResponse": "tid=47069832&transactionType=GOODS_SERVICES&posadditionalamounts.originalAmountValue=1025&giftcardIndicator=false&posAmountGratuityValue=0&pspReference=TF995R5G6L2GWR82&store=YOUR_STOREL&iso8601TxDate=2022-02-03T15%3a04%3a13.0000000%2b0000&posOriginalAmountValue=1025&txtime=16%3a04%3a13&paymentMethod=mc&txdate=03-02-2022&merchantReference=2022-02-03%2016%3a04%3a13&posadditionalamounts.originalAmountCurrency=EUR&transactionReferenceNumber=TF995R5G6L2GWR82&posAuthAmountCurrency=EUR&posAmountCashbackValue=0&posEntryMode=CLESS_CHIP&posAuthAmountValue=600", "Result": "Success" }, "ReversedAmount": 6 } } } ``` If your request failed, the [ReversalResponse.Response](https://docs.adyen.com/api-explorer/terminal-api/latest/post/reversal/#responses-200-Response) contains: * `Result`: **Failure** * `AdditionalResponse`: This includes a `message` explaining why the request failed. For example: * *Original pspReference required for this operation*: Messages like this tell you how to fix the request so you can try again. * *Transaction is already voided*: This message tells you that we already received a full reversal request for the original transaction. 4. Wait for the [CANCEL\_OR\_REFUND webhook](#cancel-or-refund-webhook) to learn the outcome. Refunds are always processed asynchronously. If successful, the refund is issued to the shopper's account. ### Refunding an ecommerce payment An ecommerce payment does have a PSP reference, but the tender reference is missing because it is generated by the terminal. To refund an ecommerce payment, you need to know the PSP reference, the date, and the currency of the original payment. ### Tab: Full refund of an ecommerce transaction Compared to a [basic full referenced refund](/point-of-sale/basic-tapi-integration/refund-payment/referenced?tab=full_refund_1), note the following request parameters: | Parameter | Required | Description | | ----------------------------------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `OriginalPOITransaction.POITransactionID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with `TransactionID`: the PSP reference of the original payment, in the format `.pspReference`. For example: **.VK9DRSLLRCQ2WN82**Do not forget the leading dot (.). Without it, you will receive the error message `unreachable host`. | | `SaleData.SaleToAcquirerData` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The currency of the refund, in the format `currency=ABC` where `ABC` is the three-letter [currency code](/development-resources/currency-codes). This must match the currency of the original payment. | | `SaleData.SaleTransactionID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with:- `TransactionID`: your reference for the refund. In your Customer Area and Adyen reports, this will show as the **merchant reference**. - `TimeStamp`: date and time in [UTC format](https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_\(UTC\)) of the refund. | ```json { "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"Reversal", "MessageType":"Request", "SaleID":"POSSystemID12345", "ServiceID":"207111108", "POIID":"V400m-324688179" }, "ReversalRequest":{ "OriginalPOITransaction":{ "POITransactionID":{ "TransactionID":".VK9DRSLLRCQ2WN82", "TimeStamp":"2022-01-31T12:08:45.004Z" } }, "ReversalReason":"MerchantCancel", "SaleData":{ "SaleToAcquirerData":"currency=EUR", "SaleTransactionID":{ "TimeStamp":"2022-02-03T15:04:14.004Z", "TransactionID":"rev-708" } } } } } ``` When you receive the `ReversalResponse`, note that the `Response.AdditionalResponse` includes: * `posOriginalAmountValue`: **0** (zero) * `posAuthAmountValue`: **0** (zero) That is because at this moment we do not know the original amount of the ecommerce payment, and thus also do not know the refund amount that we will try to get authorized. ### Tab: Partial refund of an ecommerce transaction Compared to a [basic partial referenced refund](/point-of-sale/basic-tapi-integration/refund-payment/referenced?tab=partial_refund_2), note the following request parameters: | Parameter | Required | Description | | ----------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `OriginalPOITransaction.POITransactionID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with `TransactionID`: the PSP reference of the original payment, in the format `.pspReference`. For example: **.VK9DRSLLRCQ2WN82**Do not forget the leading dot (.). Without it, you will receive the error message `unreachable host`. | ```json { "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"Reversal", "MessageType":"Request", "SaleID":"POSSystemID12345", "ServiceID":"207111108", "POIID":"V400m-324688179" }, "ReversalRequest":{ "OriginalPOITransaction":{ "POITransactionID":{ "TransactionID":".VK9DRSLLRCQ2WN82", "TimeStamp":"2022-01-31T12:08:45.004Z" } }, "ReversalReason":"MerchantCancel", "ReversedAmount":6, "SaleData":{ "SaleToAcquirerData":"currency=EUR", "SaleTransactionID":{ "TimeStamp":"2022-02-03T15:04:14.004Z", "TransactionID":"rev-708" } } } } } ``` When you receive the `ReversalResponse`, note that the `Response.AdditionalResponse` includes: * `posOriginalAmountValue`: **0** (zero) That is because at this moment we do not know the original amount of the ecommerce payment. ## Send a server-to-server refund request To return funds to the shopper: 1. From the information of the payment you want to refund, get the PSP reference. 2. Make a [/payments/{paymentPspReference}/refunds](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds) request, including the following: In your request, include: | Parameter | Required | Description | | ------------------------------------ | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `paymentPspReference` Path parameter | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The PSP reference of the payment. You can find this in the following:- The webhook message with `eventCode`: **AUTHORISATION** for the payment. - In your [Customer Area](https://ca-test.adyen.com/), in the list of payments (**Transactions** > **Payments**). - If you made a [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request for the payment, the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response. | | `merchantAccount` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The name of your merchant account that is used to process the payment. | | `amount` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The [amount](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/payments/{paymentPspReference}/refunds__reqParam_amount) that you want to refund.- The `value` must be the same or, in case of a partial refund, less than the captured `amount`. - The `currency` must match the currency used in the authorization. | | `reference` | | Your reference for the refund, for example to tag a partial refund for future reconciliation. The `reference` parameter is required for [GrabPay](/payment-methods/grabpay) refunds. | | `merchantRefundReason` | | The reason for the refund request. Possible values:- **FRAUD** - **CUSTOMER REQUEST** - **RETURN** - **DUPLICATE** - **OTHER** | **Example of a refund request for EUR 25** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments/XB7XNCQ8HXSKGK82/refunds \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "amount": { "value": 2500, "currency": "EUR" }, "reference": "YOUR_UNIQUE_REFERENCE" }' ``` #### Java ```java // Adyen Java API Library v39.3.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the LIVE environment, also include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) // Send the request ModificationsApi service = new ModificationsApi(client); PaymentRefundResponse response = service.refundCapturedPayment("paymentPspReference", paymentRefundRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php setXApiKey("ADYEN_API_KEY"); // For the LIVE environment, also include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new ModificationsApi($client); $response = $service->refundCapturedPayment('paymentPspReference', $paymentRefundRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v32.1.1 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the LIVE environment, also include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) // Send the request var service = new ModificationsService(client); var response = service.RefundCapturedPayment("paymentPspReference", paymentRefundRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v29.0.0 const { Client, CheckoutAPI } = require('@adyen/api-library'); // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const paymentRefundRequest = { merchantAccount: "ADYEN_MERCHANT_ACCOUNT", amount: { value: 2500, currency: "EUR" }, reference: "YOUR_UNIQUE_REFERENCE" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.ModificationsApi.refundCapturedPayment("paymentPspReference", paymentRefundRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.0.0 import ( "context" "github.com/adyen/adyen-go-api-library/v21/src/common" "github.com/adyen/adyen-go-api-library/v21/src/adyen" "github.com/adyen/adyen-go-api-library/v21/src/checkout" ) // For the LIVE environment, also include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) // Send the request service := client.Checkout() req := service.ModificationsApi.RefundCapturedPaymentInput("paymentPspReference").IdempotencyKey("UUID").PaymentRefundRequest(paymentRefundRequest) res, httpRes, err := service.ModificationsApi.RefundCapturedPayment(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v13.6.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "amount": { "value": 2500, "currency": "EUR" }, "reference": "YOUR_UNIQUE_REFERENCE" } # Send the request result = adyen.checkout.modifications_api.refund_captured_payment(request=json_request, paymentPspReference="paymentPspReference", idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v10.4.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT', :amount => { :value => 2500, :currency => 'EUR' }, :reference => 'YOUR_UNIQUE_REFERENCE' } # Send the request result = adyen.checkout.modifications_api.refund_captured_payment(request_body, 'paymentPspReference', headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v29.0.0 import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.ModificationsApi.refundCapturedPayment("paymentPspReference", paymentRefundRequest, { idempotencyKey: "UUID" }); ``` 3. When you receive the [/payments/{paymentPspReference}/refunds](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds) response, note: * `paymentPspReference`: the PSP reference of the authorization you want to refund. * `pspReference`: Adyen's unique reference associated with this refund request. **Example response for a refund request** ```json { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "paymentPspReference": "XB7XNCQ8HXSKGK82", "pspReference" : "JDD6LKT8MBLZNN84", "reference": "YOUR_UNIQUE_REFERENCE", "status" : "received" } ``` 4. Wait for the [REFUND webhook](#refund-webhook) to learn the outcome of the refund request. ## Webhooks Refunds are *not* processed synchronously. When you send an API request for a referenced refund, the API response only confirms we received the request. We process the refund asynchronously, and inform you of the result through a webhook. * For a Terminal API reversal request, we return a [CANCEL\_OR\_REFUND webhook](#cancel-or-refund-webhook). * For a server-to-server refund, we return a [REFUND webhook](#refund-webhook-1) To receive updates about your refunds, you must [set up webhooks](/development-resources/webhooks). ### CANCEL\_OR\_REFUND webhook Before we send your [Terminal API reversal request](#reversal-request) to be processed, we perform various validations. If these validations succeed, usually the refund itself also succeeds. You receive the outcome of the validations asynchronously, in a **CANCEL\_OR\_REFUND** [webhook](/development-resources/webhooks) that includes: | Parameter | Description | | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `eventCode` | **CANCEL\_OR\_REFUND** | | `originalReference` | The PSP reference of the original payment. | | `pspReference` | The PSP reference of the reversal that you can find in the [/payments/{paymentPspReference}/reversals](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/reversals) response | | `success` | Indicates the outcome of the refund validations. Possible values:- **true**: Adyen's validations were successful and we sent the refund request to the card scheme. This usually means that the refund will be processed successfully. However, in rare cases the refund can be rejected by the card scheme, or reversed. For information about these exceptions, see [**REFUND\_FAILED** webhook](/online-payments/refund#refund-failed), and [**REFUNDED\_REVERSED** webhook](/online-payments/refund#refunded-reversed). - **false**: the refund validations failed. The webhook includes a `reason` field with a short description of the problem. [Review the reason](/online-payments/classic-integrations/modify-payments/refund#unsuccessful-refund-request), fix the issue if possible, and resubmit the refund request. | **Example of a webhook message with the CANCEL\_OR\_REFUND event code** ```json { "live":"false", "notificationItems":[ { "NotificationRequestItem":{ "additionalData":{ "modification.action": "refund" }, "amount":{ "currency": "EUR", "value": 1025 }, "eventCode":"CANCEL_OR_REFUND", "eventDate":"2022-02-03T15:14:15.004Z", "merchantAccountCode":"YOUR_MERCHANT_ACCOUNT", "originalReference":"VK9DRSLLRCQ2WN82", "paymentMethod":"mc", "pspReference":"TF995R5G6L2GWR82", "reason":"", "success":"true" } } ] } ``` For more information about the included fields, see the [CANCEL\_OR\_REFUND](https://docs.adyen.com/api-explorer/Webhooks/latest/post/CANCEL_OR_REFUND) webhook reference. ### REFUND webhook Before we send a refund request to be processed, we perform various validations. If these validations succeed, usually the refund itself also succeeds. You receive the outcome of the validations asynchronously, in a [webhook](/development-resources/webhooks) that includes: * `eventCode`: **REFUND**. * `pspReference`: the `pspReference` from the response for your refund request. * `success`: indicates the outcome of the refund validations. Possible values: * **true**: Adyen's validations were successful and we sent the refund request to the card scheme. This usually means that the refund will be processed successfully. However, in rare cases the refund can be rejected by the card scheme, or reversed. For information about these exceptions, see [**REFUND\_FAILED** webhook](/online-payments/refund#refund-failed), and [**REFUNDED\_REVERSED** webhook](/online-payments/refund#refunded-reversed). * **false**: the refund validations failed. The webhook includes a `reason` field with a short description of the problem. [Review the reason](#failed-refund-request), fix the issue if possible, and resubmit the refund request. ### Tab: success: true ```json { "live":"false", "notificationItems":[ { "NotificationRequestItem":{ "amount":{ "currency":"EUR", "value":2500 }, "eventCode":"REFUND", "eventDate":"2021-11-01T00:19:34+01:00", "merchantAccountCode":"YOUR_MERCHANT_ACCOUNT", "merchantReference": "YOUR_UNIQUE_REFERENCE", "originalReference":"XB7XNCQ8HXSKGK82", "paymentMethod":"visa", "pspReference":"JDD6LKT8MBLZNN84", "reason":"", "success":"true" } } ] } ``` ### Tab: success: false ```json { "live":"false", "notificationItems":[ { "NotificationRequestItem":{ "amount":{ "currency":"EUR", "value":2500 }, "eventCode":"REFUND", "eventDate":"2021-11-01T00:19:34+01:00", "merchantAccountCode":"YOUR_MERCHANT_ACCOUNT", "merchantReference": "YOUR_UNIQUE_REFERENCE", "originalReference":"XB7XNCQ8HXSKGK82", "paymentMethod":"visa", "pspReference":"JDD6LKT8MBLZNN84", "reason":"Transaction hasn't been captured, refund not possible", "success":"false" } } ] } ``` For more information about the included fields, see the [REFUND](https://docs.adyen.com/api-explorer/Webhooks/latest/post/REFUND) webhook reference. ### Reasons for failed refund validation When our validations of a refund fail, you receive a webhook for the refund with `success`: **false** and the reason of the failure. The next table shows the most common reasons.\ []()\ Where the table mentions the *balance on the payment*, this refers to the amount that remains from the original payment. For example, if a transaction has a total of EUR 10 and no refund or chargeback is processed, then the balance on the payment is EUR 10. After a refund or chargeback of EUR 3 is processed, the remaining balance on the payment is EUR 7. | `reason` | Description | | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Requested refund amount too high` | No chargeback or refund has been processed, and the requested refund amount is more than the balance on the payment. | | `Already partially refunded, new requested refund amount too high` | Partial refund(s) has(/have) been processed, and the requested refund amount is more than the balance on the payment. | | `Already partially disputed, new requested refund amount too high` | Partial chargeback(s) has(/have) been processed, and the requested refund amount is more than the balance on the payment. | | `Already fully refunded, no balance available for new requested refund` | Full refund has been processed, and the remaining balance on the payment is 0. | | `Partially refunded and partially disputed, no balance available for new requested refund` | Partial refund(s) and chargeback(s) have been processed, and the requested refund amount is more than the balance on the payment. Partial refund(s) and chargeback(s) have been processed, and the balance on the payment is a negative amount. | | `Already fully disputed, no balance available for new requested refund` | Full chargeback has been processed, and the balance on the payment is 0. A full chargeback and partial refund(s) have been processed, and the balance on the payment is a negative amount. | | `Insufficient in-process funds on account` | There is not enough [balance](/account/balances) on your merchant account to process the refund. | | `Transaction hasn't been captured, refund not possible` | The refund was requested before the transaction was captured. You need to [cancel](/online-payments/cancel) the transaction instead or wait until the transaction is settled. | | `The maximum period for this operation has expired` | The refund was requested past the expiration date permitted by the payment method to process the request. | | `Amount too low to be accepted by Card Network` | The refund amount was too low. The amount must be greater than 0.01 in any currency. | | `Modification in different currency than authorisation` | The refund was requested in a currency different from the currency in which the authorization was made. | ## See also * [Digital receipts](/unified-commerce/digital-receipts)