No momento, esta página não está disponível em português
Point-of-sale icon

Cancel or refund a transaction

Cancel or refund with a PSP reference

Method

Call cancelOrRefundTransactionWithPSPReference to cancel or refund a transaction where the transaction 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.

If 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 to indicate whether a cancelOrRefund request was sent. 

Parameters

Name Type Required Description
pspReference merchantReference -white_check_mark- PSP reference of the original transaction.
merchantReference NSString -white_check_mark- Reference for the merchant, used in reporting.
refundState ADYProcessingState -white_check_mark- Indicates whether a cancelOrRefund request was sent. 
error NSError -white_check_mark- Information about any errors that occurred.

Cancel or refund with a tender reference

Method

Call cancelOrRefundTransactionWithTenderReference to cancel or refund a transaction. This is used where the transaction 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.

If the request is successful, if the he combination of tenderReference and UniqueTerminalId of the original transaction is valid 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 to indicate whether a cancelOrRefund request was sent. 

Parameters

NameTypeRequiredDescription
tenderReferenceNSString-white_check_mark-Reference for the transaction, used as the PSP reference is not available.
uniqueTerminalIdNSString-white_check_mark-Unique terminal ID to reference the PED that is processing the request.
merchantReferenceNSString-white_check_mark-Reference for the merchant, used in reporting.
refundStateADYProcessingState-white_check_mark-

Indicates whether a cancelOrRefund request was sent. 

errorNSError-white_check_mark-Information about any errors that occurred.

 * When the transactions are retrieved and their refunds are examined, each refund will have a processingState * to indicate whether a scheduleRefund-request was sent. * */ - (void)refundTransactionWithPSPReferece:(NSString *)pspReference amountToRefund:(ADYAmount *)amount terminalIdentifier:(NSString *)terminalIdentifier merchantReference:(NSString *)merchantReference tenderReference:(NSString *)tenderReference onCompletion:(void (^)(ADYProcessingState, NSError *))completion;

Partially refund a transaction

Method

Call refundTransactionWithPSPReferece to partially refund a transaction with the provided combination of pspReference, amount, terminalIdentifier, merchantReference and tenderReference  The response from the server indicates if the scheduleRefund request was received, not if it was performed.

If the request is successful, if the combination of tenderReference and UniqueTerminalId of the original transaction is valid 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 to indicate whether a scheduleRefund request was sent. 

Parameters

NameTypeRequiredDescription
pspReferencemerchantReference-white_check_mark-

PSP reference of the original transaction.

amount

ADYAmount

-white_check_mark-A container for the amount that needs to be refunded.
tenderReferenceNSString-white_check_mark-Reference for the transaction, used as the PSP reference is not available.
terminalIdentifier
NSString-white_check_mark-Unique terminal ID to reference the PED that is processing the request.
merchantReferenceNSString-white_check_mark-Reference for the merchant, used in reporting.
refundStateADYProcessingState-white_check_mark-

Indicates whether a scheduleRefund request was sent. 

onCompletion

completion

-white_check_mark-Information about any errors that occurred.

Cancel or refund from the terminal transaction list

Use this method cancel or refund a transaction from the terminal transaction list, and receive a receipt on the POS or on the PED.

You can only use this method for transactions that:

  • have been completed on the terminal that is receiving the cancel or refund request.
  • are still within the terminal storage – this is currently limited to 100 tenders.

Method

Call cancelOrRefundWithRequest on the selected ADYDevice:

(void)cancelOrRefundWithRequest:(ADYCancelOrRefundRequest *)request completion:(void (^)(ADYProcessingState state, NSArray<ADYReceipt *> *receipts, NSError *error))completion;

The response from the device indicates whether the request was received, not whether it was performed. 

Parameters

NameTypeRequiredDescription
requestADYCancelOrRefundRequest-white_check_mark-

Object containing information about the transaction that you want to cancel or refund.

completionBlock-white_check_mark-

This 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 ADYProcessingStateProcessed
  • error: contains an NSError if the request failed.

ADYCancelOrRefundRequest has the following parameters: 

Name Type Required Description
reference String -white_check_mark- The tender reference for the transaction that you want to cancel or refund.
handleReceipt Boolean -x- 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.
additionalData NSMutableDictionary -x- Contains key/value pairs that you can use to specify additional data to be passed to the terminal.