---
title: "Undo a load transaction to a gift card"
description: "Reverse a transaction that loaded funds to a gift card."
url: "https://docs.adyen.com/point-of-sale/alternative-payment-methods/gift-cards-terminal-api/void"
source_url: "https://docs.adyen.com/point-of-sale/alternative-payment-methods/gift-cards-terminal-api/void.md"
canonical: "https://docs.adyen.com/point-of-sale/alternative-payment-methods/gift-cards-terminal-api/void"
last_modified: "2020-01-07T16:48:00+01:00"
language: "en"
---

# Undo a load transaction to a gift card

Reverse a transaction that loaded funds to a gift card.

[View source](/point-of-sale/alternative-payment-methods/gift-cards-terminal-api/void.md)

With an undo request, you can reverse a gift card transaction that [loaded funds](/point-of-sale/gift-cards-terminal-api/load-a-balance) to a gift card. The amount loaded is taken off the gift card balance. However, you can only undo the most recent load transaction and this transaction must be from the past 24 hours.

You identify the transaction you want to undo by its [transaction identifier](/point-of-sale/design-your-integration/terminal-api#transaction-identifier).

You cannot use an undo request to cancel a gift card payment or to make a refund to a gift card.\
See [Cancel a payment](/point-of-sale/basic-tapi-integration/cancel-a-transaction) and [Make a refund to a gift card](/point-of-sale/gift-cards-terminal-api/refund-gift-cards).

## Requirements

Before you begin, take into account the following requirements, limitations, and preparations.

| Requirement          | Description                                                                                                                                                                                                           |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Integration type** | A [Terminal API](/point-of-sale/design-your-integration/terminal-api) integration with payment terminals.                                                                                                             |
| **Setup steps**      | Before you begin:- [Add the payment method to your Adyen account](/point-of-sale/what-we-support/payment-methods#add-payment-methods-to-your-account).
- Complete the onboarding process with the gift card provider. |

## Undo a transaction

To undo the most recent load transaction made in the past 24 hours on a gift card:

1. Get the `POITransactionID.TimeStamp` and `POITransactionID.TransactionID` of the original\
   transaction.

2. Make a [Terminal API](/point-of-sale/design-your-integration/terminal-api) stored value request, 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 **StoredValue**.

     | 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-") | **StoredValue**                                                                                                                                             |
     | `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 [StoredValueRequest.SaleData](https://docs.adyen.com/api-explorer/terminal-api/latest/post/storedvalue#request-SaleData) object with:

     | Parameter                         | Required                                                                                    | Description                                                                                                               |
     | --------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
     | `SaleTransactionID.TransactionID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your reference to identify this undo request. We recommend using a unique value.                                          |
     | `SaleTransactionID.TimeStamp`     | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Date and time of the request, in [UTC format](https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_\(UTC\)). |

   - The [StoredValueRequest.StoredValueData](https://docs.adyen.com/api-explorer/terminal-api/latest/post/storedvalue#request-StoredValueData) object with:

     | Parameter                    | Required                                                                                    | Description                                                                                                                                                                                                                                                          |
     | ---------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
     | `StoredValueTransactionType` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Reverse**                                                                                                                                                                                                                                                          |
     | `OriginalPOITransaction`     | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The details of the transaction that you want to undo: - `POITransactionID.TimeStamp`: date and time of the original transaction.
     - `POITransactionID.TransactionID`: transaction identifier of the original transaction, in one of the formats from the table below. |

     | Format                         | Example                                                                                   |
     | ------------------------------ | ----------------------------------------------------------------------------------------- |
     | `tenderReference.pspReference` | **A7sM001574852436000.NC6HT9CRT65ZGN82**Recommended format                                |
     | `pspReference`                 | **.NC6HT9CRT65ZGN82**Do not forget the leading dot (.).                                   |
     | `tenderReference`              | **A7sM001574852436000**Only when using the same terminal as for the original transaction. |

   #### JSON

   ```json
   {
     "SaleToPOIRequest":{
       "MessageHeader":{
         "MessageType":"Request",
         "MessageClass":"Service",
         "MessageCategory":"StoredValue",
         "SaleID":"POSSystemID12345",
         "POIID":"V400m-324688179",
         "ProtocolVersion":"3.0",
         "ServiceID":"9265"
         },
       "StoredValueRequest":{
         "SaleData":{
           "SaleTransactionID":{
             "TransactionID":"44739",
             "TimeStamp":"2019-12-22T10:10:34+00:00"
             }
         },
         "StoredValueData": [
           {
             "StoredValueTransactionType": "Reverse",
             "OriginalPOITransaction": {
               "POITransactionID": {
                 "TransactionID": "A7sM001574852436000.NC6HT9CRT65ZGN82",
                 "TimeStamp": "2019-12-22T09:01:15+00:00"
               }
             }
           }
         ]
       }
     }
   }
   ```

   #### Java

   ```java
   String serviceID = "YOUR_UNIQUE_ATTEMPT_ID";
   String saleID = "YOUR_CASH_REGISTER_ID";
   String POIID = "YOUR_TERMINAL_ID";

   SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest();
   MessageHeader messageHeader = new MessageHeader();
   messageHeader.setProtocolVersion("3.0");
   messageHeader.setMessageClass( MessageClassType.SERVICE );
   messageHeader.setMessageCategory( MessageCategoryType.STORED_VALUE );
   messageHeader.setMessageType( MessageType.REQUEST );
   messageHeader.setServiceID(serviceID);
   messageHeader.setSaleID(saleID);
   messageHeader.setPOIID(POIID);
   saleToPOIRequest.setMessageHeader(messageHeader);

   StoredValueRequest storedValueRequest = new StoredValueRequest();
   SaleData saleData = new SaleData();
   TransactionIdentification saleTransactionID = new TransactionIdentification();
   saleTransactionID.setTransactionID(transactionID);
   saleTransactionID.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
   saleData.setSaleTransactionID(saleTransactionID);
   storedValueRequest.setSaleData(saleData);

   StoredValueData storedValueData = new StoredValueData();
   storedValueData.setStoredValueTransactionType( StoredValueTransactionType.REVERSE );
   OriginalPOITransaction originalPOITransaction = new OriginalPOITransaction();
   TransactionIdentification pOITransactionID = new TransactionIdentification();
   pOITransactionID.setTransactionID(transactionID);
   pOITransactionID.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
   originalPOITransaction.setPOITransactionID(pOITransactionID);
   storedValueData.setOriginalPOITransaction(originalPOITransaction);
   storedValueRequest.setStoredValueData(storedValueData);
   saleToPOIRequest.setStoredValueRequest(storedValueRequest);
   terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);
   ```

3. In the [StoredValueResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/storedvalue#responses-200-Response), check the following:

   * `StoredValueTransactionType`: **Reverse** and `Response.Result`: **Success** indicate the loaded funds were reversed.

   * In the `StoredValueResult` object, `StoredValueAccountStatus` indicates the `CurrentBalance` remaining on the card after undoing a load request.

   * `POIData.POITransactionID.TransactionID`: This is [Transaction identifier](/point-of-sale/design-your-integration/terminal-api#transaction-identifier) for the undo request.

   * `Response.AdditionalResponse`: additional transaction data. Depending on the format you used in the request, you receive either a string of form-encoded key-value pairs or a Base64 string that you need to decode to get a JSON object.

   ```json
   {
     "SaleToPOIResponse":{
       "StoredValueResponse":{
         "POIData":{
           "POITransactionID":{
             "TimeStamp":"2019-03-26T09:31:29.000Z",
             "TransactionID":"pZjO001522056689002.NC6HT9CRT65ZGN82"
           }
         }
         ...,
         "StoredValueResult":[
           {
             "StoredValueTransactionType":"Reverse",
             "StoredValueAccountStatus": {
               "CurrentBalance":265.79
             }
           }
         ],
         "Response":{
           "Result":"Success",
           "AdditionalResponse":"tid=46742566&transactionType=REFUND&backendGiftcardIndicator=false&posAmountGratuityValue=0&giftcardIndicator=true&pspReference=NC6HT9CRT65ZGN82&storedValueApi=true&currentBalanceCurrency=USD&txtime=10%3a27%3a20&iso8601TxDate=2019-12-31T09%3a27%3a20.0000000%2b0000&posOriginalAmountValue=0&txdate=31-12-2019&merchantReference=17322&transactionReferenceNumber=NC6HT9CRT65ZGN82&posadditionalamounts.originalAmountCurrency=EUR&posAuthAmountCurrency=EUR&posAmountCashbackValue=0&posAuthAmountValue=0&currentBalanceValue=26579"
         }
       },
       "MessageHeader":{
         "ProtocolVersion":"3.0",
         "SaleID":"POSSystemID12345",
         "MessageClass":"Service",
         "MessageCategory":"StoredValue",
         "ServiceID":"9264",
         "POIID":"V400m-324688179",
         "MessageType":"Response"
       }
     }
   }
   ```

## See also

* [Load funds to a gift card](/point-of-sale/gift-cards-terminal-api/load-a-balance)
* [Make a refund to a gift card](/point-of-sale/gift-cards-terminal-api/refund-gift-cards)
* [Cancel a payment](/point-of-sale/basic-tapi-integration/cancel-a-transaction/)
* [Deactivate a gift card](/point-of-sale/gift-cards-terminal-api/deactivate)
