--- title: "Cancel an in-progress transaction" description: "Learn how to cancel a transaction while it is in-progress." url: "https://docs.adyen.com/point-of-sale/basic-tapi-integration/cancel-a-transaction" source_url: "https://docs.adyen.com/point-of-sale/basic-tapi-integration/cancel-a-transaction.md" canonical: "https://docs.adyen.com/point-of-sale/basic-tapi-integration/cancel-a-transaction" last_modified: "2023-09-13T04:31:00+02:00" language: "en" --- # Cancel an in-progress transaction Learn how to cancel a transaction while it is in-progress. [View source](/point-of-sale/basic-tapi-integration/cancel-a-transaction.md) ##### Want to cancel an authorized payment? If you are using [delayed capture](/point-of-sale/capturing-payments#delayed-capture) or [manual capture](/point-of-sale/capturing-payments#manual-capture) instead of automatic capture, you can cancel an authorization. Sometimes your shoppers change their mind in mid-purchase, or store staff realize they have made a mistake while the shopper is using the terminal. You can then send a request to abort the in-progress transaction. When this request is received before the transaction is approved on the terminal, the payment is cancelled. Here we explain how you can cancel in-progress transactions from: * [Your POS app](#cancel-from-register) by sending a Terminal API abort request. * [The terminal](#cancel-from-terminal). ## Requirements Before you begin, take into account the following requirements. | Requirement | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | **Integration type** | A [Terminal API integration](/point-of-sale/get-started) or [Standalone solution](/point-of-sale/standalone) with payment terminals. | ## Cancel from your POS app While a payment request is in progress, you can cancel it by making an abort request from your POS app. If you cancel before the shopper presents the card, the payment prompt disappears from the terminal display.\ You can also cancel after the shopper presents the card, as long as the payment is not completed yet. For example, after presenting the card but before entering the PIN. The terminal then shows **Cancelled**. After the payment is completed, you cannot use an abort request to cancel the payment. 1. Make a [Terminal API](/point-of-sale/design-your-integration/terminal-api) abort 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 **Abort**. | 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-") | **Abort** | | `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 [AbortRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/abort) object with: | Parameter | Required | Description | | ------------------ | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AbortReason` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **MerchantAbort** | | `MessageReference` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with:- `MessageCategory`: **Payment** - `SaleID`: your unique ID of the POS system component that made the payment request. - `ServiceID`: The `ServiceID` of the transaction request being cancelled. | The example shows how to cancel an in-progress payment with a `ServiceID` of **21796**. **Abort an in-progress payment** ```json { "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"Abort", "MessageType":"Request", "SaleID":"POSSystemID12345", "ServiceID":"29239", "POIID":"V400m-324688179" }, "AbortRequest":{ "AbortReason":"MerchantAbort", "MessageReference":{ "MessageCategory":"Payment", "SaleID":"POSSystemID12345", "ServiceID":"21796" } } } } ``` 2. Check the responses: * A successful abort request returns a response with a `200 OK` HTTP status code and no body. * The [payment request](/point-of-sale/basic-tapi-integration/make-a-payment/#make-a-payment) returns a response containing: * `Result`: **Failure** * `ErrorCondition`: **Aborted** 3. To double-check the payment was indeed cancelled, [make a transaction status request](/point-of-sale/basic-tapi-integration/verify-transaction-status), including: * The [TransactionStatusRequest.MessageReference](https://docs.adyen.com/api-explorer/terminal-api/latest/post/transactionstatus#request-MessageReference) object with: | Parameter | Required | Description | | ----------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | | `SaleID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The `SaleID` of the POS system component that made the payment you tried to cancel. | | `ServiceID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The `ServiceID` of the payment you tried to cancel. | | `MessageCategory` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to **Payment**. | The example shows how to check the transaction status of a payment with `ServiceID` **21796**, which you tried to cancel. **Check the transaction status of the payment** ```json { "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"TransactionStatus", "MessageType":"Request", "SaleID":"POSSystemID12345", "ServiceID":"29240", "POIID":"V400m-324688179" }, "TransactionStatusRequest":{ "ReceiptReprintFlag":true, "DocumentQualifier":[ "CashierReceipt", "CustomerReceipt" ], "MessageReference":{ "SaleID":"POSSystemID12345", "ServiceID":"21796", "MessageCategory":"Payment" } } } } ``` 4. Check the response: If the payment was cancelled, the [TransactionStatusResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/transactionstatus#responses-200-Response) has a `RepeatedResponseMessageBody` with an `ErrorCondition` of **Aborted**. ### Cancel when you do not know the ServiceID In case of a communication or technical issue, the payment or card acquisition request can remain in-progress. When this happens, the terminal cannot be used until the request times out on its own, usually after 150 seconds. Because you haven't received the response yet, you do not have the `ServiceID` required to cancel the request. You can get the `ServiceID` of the original request by sending a transaction status request with an empty `TransactionStatusRequest` object. You can then follow up with request to cancel the [payment](/point-of-sale/basic-tapi-integration/cancel-a-transaction#cancel-from-register) or [card acquisition](/point-of-sale/card-acquisition#cancel-in-progress) request. Sending a transaction status request with an empty `TransactionStatusRequest` object is only supported for payment and card acquisition requests that are still in progress. To get the `ServiceID` of the original request: 1. Make a Terminal API [transaction status request](/point-of-sale/basic-tapi-integration/verify-transaction-status), 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 **TransactionStatus**. | 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-") | **TransactionStatus** | | `MessageType` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Request** | | `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. | | `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. | | `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]*. | - [TransactionStatusRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/transactionstatus): An empty object. **Get ServiceID of the in-progress payment request** ```json { "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"TransactionStatus", "MessageType":"Request", "ServiceID":"29245", "SaleID":"POSSystemID12345", "POIID":"V400m-324688179" }, "TransactionStatusRequest":{ } } } ``` 2. From the [TransactionStatusResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/transactionstatus#responses-200-Response), save the following: * `ServiceID`: The unique ID of the original payment or card acquisition request. * `SaleID`: Your unique ID for the system where you send this request from. * `MessageCategory`: Can be `Payment` or `CardAcquisition`. **ServiceID of the in-progress payment request** ```json { "SaleToPOIResponse":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"TransactionStatus", "MessageType":"Response", "ServiceID":"29245", "SaleID":"POSSystemID12345", "POIID":"V400m-324688179" }, "TransactionStatusResponse":{ "MessageReference":{ "MessageCategory":"Payment", "SaleID":"POSSystemID12345", "ServiceID":"816" }, "Response":{ "AdditionalResponse":"...", "ErrorCondition":"InProgress", "Result":"Failure" } } } } ``` 3. Follow up with a request to cancel the in-progress [payment](/point-of-sale/basic-tapi-integration/cancel-a-transaction#cancel-from-register) or [card acquisition](/point-of-sale/card-acquisition#cancel-in-progress) using the `ServiceID` from the transaction status response. ## Cancel from the terminal To cancel an in-progress payment on a terminal: * On the terminal keypad, select the *Cancel* key **![](/images/e/b/5/8/6/eb5864c171bd3eac47d4a415a1f7e5dc0b075c28-cancel2x.png)**\ In case of a terminal without a keypad, on the display select the *Cancel* icon ![](/user/pages/reuse/image-library/buttons/cancel-icon/nav-cancel.svg?decoding=auto\&fetchpriority=auto) If this is successful: * The terminal shows a **Cancelled** message on the display. * The [payment request](/point-of-sale/basic-tapi-integration/make-a-payment/#make-a-payment) returns a response containing: * `Result`: **Failure** * `ErrorCondition`: **Cancel** ### Canceling a signature on the display In a Terminal API integration with a terminal that is configured to let shoppers draw their *signature on the display*, the transaction is already authorized when the signature prompt appears. Therefore, the terminal always approves the signature even when the shopper selects **Cancel** **![](/images/e/b/5/8/6/eb5864c171bd3eac47d4a415a1f7e5dc0b075c28-cancel2x.png)** on the signature screen. See [Signature](/point-of-sale/cardholder-verification-methods#signature) for more information. ## Handling failed cancel requests If your cancel request failed (and the payment was approved), you will need to refund the payment. For more information on refunding a payment, see [Refund a completed payment](/point-of-sale/basic-tapi-integration/refund-payment). ## See also * [Implement the payment flow](/point-of-sale/basic-tapi-integration) * [Use a standalone terminal](/point-of-sale/standalone/standalone-use)