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 (tick)

PSP reference of the original transaction.

merchantReference NSString (tick) Reference for the merchant, used in reporting.
refundState ADYProcessingState (tick)

Indicates whether a cancelOrRefund request was sent. 

error NSError (tick) 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

Name Type Required Description
tenderReference NSString (tick) Reference for the transaction, used as the PSP reference is not available.
uniqueTerminalId NSString (tick) Unique terminal ID to reference the PED that is processing the request.
merchantReference NSString (tick) Reference for the merchant, used in reporting.
refundState ADYProcessingState (tick)

Indicates whether a cancelOrRefund request was sent. 

error NSError (tick) 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

Name Type Required Description
pspReference merchantReference (tick)

PSP reference of the original transaction.

amount

ADYAmount

(tick) A container for the amount that needs to be refunded.
tenderReference NSString (tick) Reference for the transaction, used as the PSP reference is not available.
terminalIdentifier
NSString (tick) Unique terminal ID to reference the PED that is processing the request.
merchantReference NSString (tick) Reference for the merchant, used in reporting.
refundState ADYProcessingState (tick)

Indicates whether a scheduleRefund request was sent. 

onCompletion

completion

(tick) 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

Name Type Required Description
request ADYCancelOrRefundRequest (tick)

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

completion Block (tick)

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 (tick) The tender reference for the transaction that you want to cancel or refund.
handleReceipt Boolean (error) 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 (error)

Contains key/value pairs that you can use to specify additional data to be passed to the terminal.