Terminal-2 icon

Partially refund a balance

Implement the callback

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

Allocate the request struct

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

refund_allocate

Allocates, initializes and returns a 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 refund function

Call the refund function to initiate a cancel or refund on a transaction that has been processed by the Adyen payments platform. In the refund request, include a modification_amount_currency and m``odification_amount_value that specifies the amount to be refunded.

Parameters

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

Parameters

Value Description
refund_response Pointer to the callback function in the POS that will be called with the results of the 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.