Terminal-2 icon

Refund a transaction from the PED

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 cancel or refund method for transactions that:

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

Implement the callback

Implement the callback based on the signature in the cancel_or_refund_on_terminal_extern.h file and pass this as a parameter of the cancel_or_refund_on_terminal_allocate call. For more information on how to do this, see Implement callbacks.

Allocate the request struct

Allocates, initializes and returns a cancel_or_refund_on_terminal_request struct. Populate the request by performing string duplication.

To specify where you want to receive the receipt, use the handle_receipt field in the cancel_or_refund_on_terminal_request struct: 

  • To handle and print the receipt on the POS, set the handle_receipt field to true
  • To have the PED print the receipt, omit the handle_receipt field (if the terminal has no printer, the transaction will fail).

If you want the data for later use, retain it, or it will be released automatically.

NameDescription

cancel_or_refund_on_terminal_allocate

Allocates, initializes and returns a cancel_or_refund_on_terminal_request struct. Populate the request by performing string duplication.

If you want the data for later use, retain it, or it will be released automatically.

Call the cancel_or_refund_on_terminal function

Call the cancel_or_refund_on_terminal function to cancel or refund a completed transaction from the terminal transaction list. The transaction must have been completed on the PED that is receiving the cancel or refund request, and must be still within the PED storage (this is currently limited to 100 tenders.)

Parameters

Value Description
cancel_or_refund_on_terminal_request Pointer to the cancel_or_refund_on_terminal_request struct, this struct contains all the input parameters for this call.
cancel_or_refund_on_terminal_response Pointer to the callback function in the POS that will be called with the results of the cancel_or_refund_on_terminal call
echo_struct Pointer to a POS defined struct. Returned in the callback. It can be used to share a POS data struct between the call to the library and the callback from the library in response to the call.

Handle the callback

The cancel_or_refund_on_terminal_CB returns the immediate response to the call and a pointer to the POS-defined echo struct.

Parameters

Value Description
cancel_or_refund_on_terminal_response Pointer to the callback function in the POS that will be called with the results of the cancel_or_refund_on_terminal call
echo_struct Pointer to a POS defined struct. Returned in the callback. It can be used to share a POS data struct between the call to the library and the callback from the library in response to the call.