{"title":"Cancel or refund a transaction","category":"default","creationDate":1776961627,"content":"<h2 id=\"cancel-or-refund-with-a-psp-reference\">Cancel or refund with a PSP reference<\/h2>\n<h3 id=\"method\">Method<\/h3>\n<p>Call <code>cancelOrRefundTransactionWithPSPReference<\/code>\u00a0to cancel or refund a transaction where the\u00a0transaction was processed online successfully and generated a PSP reference. The response from the server indicates if the cancel or refund was received, not if it was performed.<\/p>\n<p>If the request is successful, if the <code>pspReference<\/code> of the original transaction is valid, and if the transaction was not already cancelled or refunded, the cancel or refund will always be performed. When the transactions are retrieved and their refunds are examined, each refund will have a <code>processingState<\/code>\u00a0to indicate whether a <code>cancelOrRefund<\/code>\u00a0request was sent.\u00a0<\/p>\n<h3 id=\"parameters\">Parameters<\/h3>\n<table>\n<thead>\n<tr>\n<th>Name<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>pspReference<\/code><\/td>\n<td>merchantReference<\/td>\n<td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>PSP reference of the original transaction.<\/td>\n<\/tr>\n<tr>\n<td><code>merchantReference<\/code><\/td>\n<td>NSString<\/td>\n<td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Reference for the merchant, used in reporting.<\/td>\n<\/tr>\n<tr>\n<td><code>refundState<\/code><\/td>\n<td>ADYProcessingState<\/td>\n<td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Indicates whether a\u00a0<code>cancelOrRefund<\/code>\u00a0request was sent.\u00a0<\/td>\n<\/tr>\n<tr>\n<td><code>error<\/code><\/td>\n<td>NSError<\/td>\n<td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Information about any errors that occurred.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"cancel-or-refund-with-a-tender-reference\">Cancel or refund with a tender reference<\/h2>\n<h3 id=\"method-1\">Method<\/h3>\n<p>Call\u00a0<code>cancelOrRefundTransactionWithTenderReference<\/code>\u00a0to cancel or refund a transaction. This is used where the\u00a0transaction was offline with the provided combination of <code>tenderReference<\/code> and UniqueTerminalId (Model-SerialNumber). The response from the server indicates if the cancel or refund was received, not if it was performed.<\/p>\n<p>If the request is successful, if the\u00a0the combination of <code>tenderReference<\/code> and <code>UniqueTerminalId<\/code> of the original transaction is valid\u00a0of the original transaction is valid, and if the transaction was not already cancelled or refunded, the cancel or refund will always be performed. When the transactions are retrieved and their refunds are examined, each refund will have a\u00a0<code>processingState<\/code>\u00a0to indicate whether a\u00a0<code>cancelOrRefund<\/code>\u00a0request was sent.\u00a0<\/p>\n<h3 id=\"parameters-1\">Parameters<\/h3>\n<table style=\"width:100%;\"><colgroup><col style=\"width: 17%\"><col style=\"width: 17%\"><col style=\"width: 9%\"><col style=\"width: 55%\"><\/colgroup><thead><tr class=\"header\"><th>Name<\/th><th>Type<\/th><th>Required<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>tenderReference<\/code><\/td><td>NSString<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td>Reference for the transaction, used as the PSP reference is not available.<\/td><\/tr><tr><td><code>uniqueTerminalId<\/code><\/td><td>NSString<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td>Unique terminal ID to reference the PED that is processing the request.<\/td><\/tr><tr><td><code>merchantReference<\/code><\/td><td>NSString<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td>Reference for the merchant, used in reporting.<\/td><\/tr><tr><td><code>refundState<\/code><\/td><td>ADYProcessingState<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td><p>Indicates whether a\u00a0<code>cancelOrRefund<\/code>\u00a0request was sent.\u00a0<\/p><\/td><\/tr><tr><td><code>error<\/code><\/td><td>NSError<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td>Information about any errors that occurred.<\/td><\/tr><\/tbody><\/table>\n<p>\u00a0* When the transactions are retrieved and their refunds are examined, each refund will have a processingState * to indicate whether a scheduleRefund-request was sent. * *\/\u00a0-\u00a0(void)refundTransactionWithPSPReferece:(NSString\u00a0*)pspReference amountToRefund:(ADYAmount\u00a0*)amount terminalIdentifier:(NSString\u00a0*)terminalIdentifier merchantReference:(NSString\u00a0*)merchantReference tenderReference:(NSString\u00a0*)tenderReference onCompletion:(void\u00a0(^)(ADYProcessingState,\u00a0NSError\u00a0*))completion;<\/p>\n<h2 id=\"partially-refund-a-transaction\">Partially refund a transaction<\/h2>\n<h3 id=\"method-2\">Method<\/h3>\n<p>Call\u00a0<code>refundTransactionWithPSPReferece<\/code>\u00a0to\u00a0partially refund a transaction with the provided combination of <code>pspReference<\/code>, <code>amount<\/code>, <code>terminalIdentifier<\/code>, <code>merchantReference<\/code> and <code>tenderReference<\/code>\u00a0 The response from the server indicates if the <code>scheduleRefund<\/code> request was received, not if it was performed.<\/p>\n<p>If the request is successful, if the combination of\u00a0<code>tenderReference<\/code>\u00a0and\u00a0<code>UniqueTerminalId<\/code>\u00a0of the original transaction is valid\u00a0of the original transaction is valid, and if the transaction was not already cancelled or refunded, the cancel or refund will always be performed. When the transactions are retrieved and their refunds are examined, each refund will have a\u00a0<code>processingState<\/code>\u00a0to indicate whether a\u00a0<code>scheduleRefund<\/code>\u00a0request was sent.\u00a0<\/p>\n<h3 id=\"parameters-2\">Parameters<\/h3>\n<table style=\"width:100%;\"><colgroup><col style=\"width: 17%\"><col style=\"width: 17%\"><col style=\"width: 9%\"><col style=\"width: 55%\"><\/colgroup><thead><tr class=\"header\"><th>Name<\/th><th>Type<\/th><th>Required<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>pspReference<\/code><\/td><td>merchantReference<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td><p>PSP reference of the original transaction.<\/p><\/td><\/tr><tr><td><pre class=\"wikicode prettyprint prettyprinted\"><code>amount<\/code><\/pre><\/td><td><p>ADYAmount<\/p><\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td>A container for the amount that needs to be refunded.<\/td><\/tr><tr><td><code>tenderReference<\/code><\/td><td>NSString<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td>Reference for the transaction, used as the PSP reference is not available.<\/td><\/tr><tr><td><pre class=\"wikicode prettyprint prettyprinted\"><code>terminalIdentifier<\/code><\/pre><\/td><td>NSString<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td>Unique terminal ID to reference the PED that is processing the request.<\/td><\/tr><tr><td><code>merchantReference<\/code><\/td><td>NSString<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td>Reference for the merchant, used in reporting.<\/td><\/tr><tr><td><code>refundState<\/code><\/td><td>ADYProcessingState<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td><p>Indicates whether a\u00a0<code>scheduleRefund<\/code>\u00a0request was sent.\u00a0<\/p><\/td><\/tr><tr><td><pre class=\"wikicode prettyprint prettyprinted\"><code>onCompletion<\/code><\/pre><\/td><td><p>completion<\/p><\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td>Information about any errors that occurred.<\/td><\/tr><\/tbody><\/table>\n<h2 id=\"cancel-or-refund-from-the-terminal-transaction-list\">Cancel or refund from the terminal transaction list<\/h2>\n<p>Use this method\u00a0cancel or refund a transaction from the terminal transaction list, and receive a receipt on the POS or on the PED.<\/p>\n<div class=\"sc-notice note\"><div>\n<p>You can only use this method for transactions that:<\/p>\n<ul>\n<li>have been completed on the terminal that is receiving the cancel or refund request.<\/li>\n<li>are still within the terminal storage \u2013 this is currently limited to 100 tenders.<\/li>\n<\/ul>\n<\/div><\/div>\n<h3 id=\"method-3\">Method<\/h3>\n<p>Call\u00a0<code>cancelOrRefundWithRequest<\/code> on the selected <code>ADYDevice<\/code>:<\/p>\n<pre><code class=\"language-objectivec\">(void)cancelOrRefundWithRequest:(ADYCancelOrRefundRequest *)request completion:(void (^)(ADYProcessingState state, NSArray&lt;ADYReceipt *&gt; *receipts, NSError *error))completion;<\/code><\/pre>\n<p>The\u00a0response from the device indicates whether\u00a0the\u00a0request was received, not whether it was performed.\u00a0<\/p>\n<h3 id=\"parameters-3\">Parameters<\/h3>\n<table><thead><tr class=\"header\"><th>Name<\/th><th>Type<\/th><th>Required<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>request<\/code><\/td><td>ADYCancelOrRefundRequest<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td><p>Object containing information about the transaction that you want to cancel or refund.<\/p><\/td><\/tr><tr><td><code>completion<\/code><\/td><td>Block<\/td><td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td><td><p>This block called when the request was processed. Parameters:<\/p><ul><li><code>state<\/code>: contains the processing state of the cancel or refund.<\/li><li><code>receipts<\/code>: an array that contains cancel\/refund receipts if the processing state is <code>ADYProcessingStateProcessed<\/code><\/li><li><code>error<\/code>: contains an NSError if the request failed.<\/li><\/ul><\/td><\/tr><\/tbody><\/table>\n<p>ADYCancelOrRefundRequest has the following parameters:\u00a0<\/p>\n<table>\n<thead>\n<tr>\n<th>Name<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>reference<\/code><\/td>\n<td>String<\/td>\n<td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The tender reference for the transaction that you want to cancel or refund.<\/td>\n<\/tr>\n<tr>\n<td><code>handleReceipt<\/code><\/td>\n<td>Boolean<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<td>Specifies that the POS handles and prints receipts. If omitted, it is required that the PED prints the receipt. If there is no printer unit, the transaction will fail.<\/td>\n<\/tr>\n<tr>\n<td><code>additionalData<\/code><\/td>\n<td>NSMutableDictionary<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<td>Contains key\/value pairs that you can use to specify additional data to be passed to the terminal.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>","url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/ios-integration\/key-steps-ios\/process-a-basic-transaction-ios\/cancel-or-refund-a-transaction-ios","articleFields":{"id":"39946599","type":"page","_expandable":{"operations":""},"status":"current"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/ios-integration\/key-steps-ios\/process-a-basic-transaction-ios\/cancel-or-refund-a-transaction-ios","title":"Cancel or refund a transaction","content":"Cancel or refund with a PSP reference\nMethod\nCall cancelOrRefundTransactionWithPSPReference\u00a0to cancel or refund a transaction where the\u00a0transaction was processed online successfully and generated a PSP reference. The response from the server indicates if the cancel or refund was received, not if it was performed.\nIf the request is successful, if the pspReference of the original transaction is valid, and if the transaction was not already cancelled or refunded, the cancel or refund will always be performed. When the transactions are retrieved and their refunds are examined, each refund will have a processingState\u00a0to indicate whether a cancelOrRefund\u00a0request was sent.\u00a0\nParameters\n\n\n\nName\nType\nRequired\nDescription\n\n\n\n\npspReference\nmerchantReference\n\nPSP reference of the original transaction.\n\n\nmerchantReference\nNSString\n\nReference for the merchant, used in reporting.\n\n\nrefundState\nADYProcessingState\n\nIndicates whether a\u00a0cancelOrRefund\u00a0request was sent.\u00a0\n\n\nerror\nNSError\n\nInformation about any errors that occurred.\n\n\n\nCancel or refund with a tender reference\nMethod\nCall\u00a0cancelOrRefundTransactionWithTenderReference\u00a0to cancel or refund a transaction. This is used where the\u00a0transaction was offline with the provided combination of tenderReference and UniqueTerminalId (Model-SerialNumber). The response from the server indicates if the cancel or refund was received, not if it was performed.\nIf the request is successful, if the\u00a0the combination of tenderReference and UniqueTerminalId of the original transaction is valid\u00a0of the original transaction is valid, and if the transaction was not already cancelled or refunded, the cancel or refund will always be performed. When the transactions are retrieved and their refunds are examined, each refund will have a\u00a0processingState\u00a0to indicate whether a\u00a0cancelOrRefund\u00a0request was sent.\u00a0\nParameters\nNameTypeRequiredDescriptiontenderReferenceNSStringReference for the transaction, used as the PSP reference is not available.uniqueTerminalIdNSStringUnique terminal ID to reference the PED that is processing the request.merchantReferenceNSStringReference for the merchant, used in reporting.refundStateADYProcessingStateIndicates whether a\u00a0cancelOrRefund\u00a0request was sent.\u00a0errorNSErrorInformation about any errors that occurred.\n\u00a0* When the transactions are retrieved and their refunds are examined, each refund will have a processingState * to indicate whether a scheduleRefund-request was sent. * *\/\u00a0-\u00a0(void)refundTransactionWithPSPReferece:(NSString\u00a0*)pspReference amountToRefund:(ADYAmount\u00a0*)amount terminalIdentifier:(NSString\u00a0*)terminalIdentifier merchantReference:(NSString\u00a0*)merchantReference tenderReference:(NSString\u00a0*)tenderReference onCompletion:(void\u00a0(^)(ADYProcessingState,\u00a0NSError\u00a0*))completion;\nPartially refund a transaction\nMethod\nCall\u00a0refundTransactionWithPSPReferece\u00a0to\u00a0partially refund a transaction with the provided combination of pspReference, amount, terminalIdentifier, merchantReference and tenderReference\u00a0 The response from the server indicates if the scheduleRefund request was received, not if it was performed.\nIf the request is successful, if the combination of\u00a0tenderReference\u00a0and\u00a0UniqueTerminalId\u00a0of the original transaction is valid\u00a0of the original transaction is valid, and if the transaction was not already cancelled or refunded, the cancel or refund will always be performed. When the transactions are retrieved and their refunds are examined, each refund will have a\u00a0processingState\u00a0to indicate whether a\u00a0scheduleRefund\u00a0request was sent.\u00a0\nParameters\nNameTypeRequiredDescriptionpspReferencemerchantReferencePSP reference of the original transaction.amountADYAmountA container for the amount that needs to be refunded.tenderReferenceNSStringReference for the transaction, used as the PSP reference is not available.terminalIdentifierNSStringUnique terminal ID to reference the PED that is processing the request.merchantReferenceNSStringReference for the merchant, used in reporting.refundStateADYProcessingStateIndicates whether a\u00a0scheduleRefund\u00a0request was sent.\u00a0onCompletioncompletionInformation about any errors that occurred.\nCancel or refund from the terminal transaction list\nUse this method\u00a0cancel or refund a transaction from the terminal transaction list, and receive a receipt on the POS or on the PED.\n\nYou can only use this method for transactions that:\n\nhave been completed on the terminal that is receiving the cancel or refund request.\nare still within the terminal storage \u2013 this is currently limited to 100 tenders.\n\n\nMethod\nCall\u00a0cancelOrRefundWithRequest on the selected ADYDevice:\n(void)cancelOrRefundWithRequest:(ADYCancelOrRefundRequest *)request completion:(void (^)(ADYProcessingState state, NSArray&lt;ADYReceipt *&gt; *receipts, NSError *error))completion;\nThe\u00a0response from the device indicates whether\u00a0the\u00a0request was received, not whether it was performed.\u00a0\nParameters\nNameTypeRequiredDescriptionrequestADYCancelOrRefundRequestObject containing information about the transaction that you want to cancel or refund.completionBlockThis block called when the request was processed. Parameters:state: contains the processing state of the cancel or refund.receipts: an array that contains cancel\/refund receipts if the processing state is ADYProcessingStateProcessederror: contains an NSError if the request failed.\nADYCancelOrRefundRequest has the following parameters:\u00a0\n\n\n\nName\nType\nRequired\nDescription\n\n\n\n\nreference\nString\n\nThe tender reference for the transaction that you want to cancel or refund.\n\n\nhandleReceipt\nBoolean\n\nSpecifies that the POS handles and prints receipts. If omitted, it is required that the PED prints the receipt. If there is no printer unit, the transaction will fail.\n\n\nadditionalData\nNSMutableDictionary\n\nContains key\/value pairs that you can use to specify additional data to be passed to the terminal.\n\n\n","type":"page","locale":"pt","boost":13,"hierarchy":{"lvl0":"Home","lvl1":"Terminais","lvl2":"Deprecation of classic libraries","lvl3":"Library integrations","lvl4":"iOS integration","lvl5":"Key steps","lvl6":"Process a basic transaction","lvl7":"Cancel or refund a transaction"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/point-of-sale","lvl2":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation","lvl3":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations","lvl4":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/ios-integration","lvl5":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/ios-integration\/key-steps-ios","lvl6":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/ios-integration\/key-steps-ios\/process-a-basic-transaction-ios","lvl7":"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/ios-integration\/key-steps-ios\/process-a-basic-transaction-ios\/cancel-or-refund-a-transaction-ios"},"levels":8,"category":"In-person payments","category_color":"green","tags":["Cancel","refund","transaction"]}}
