Terminal-2 icon

Refund a transaction from the POS

Implement the callback

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

Allocate the request struct

Allocates, initializes and returns a cancel_or_refund_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.

NameDescription

cancel_or_refund_allocate

Allocates, initializes and returns a cancel_or_refund_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 Function

Call the cancel_or_refund function to initiate a cancel or refund on a transaction that has been processed by the Adyen payments platform.

Parameters

Value Description
cancel_or_refund_request Pointer to the cancel_or_refund_request struct, this struct contains all the input parameters for this call.
cancel_or_refund_response Pointer to the callback function in the POS that will be called with the results of the cancel_or_refund 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_CB returns the immediate response to the call and a pointer to the POS-defined echo struct.

Parameters

Value Description
cancel_or_refund_response Pointer to the callback function in the POS that will be called with the results of the cancel_or_refund call. If the refund was successful, this struct should should return a result of "refund-received". 
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.