--- title: "Refund a transaction from the POS" url: "https://docs.adyen.com/point-of-sale/classic-library-deprecation/classic-library-integrations/c-library-integration/key-steps-c-library/cancel-or-refund-a-transaction-c-library/refund-a-transaction-from-the-pos-c" source_url: "https://docs.adyen.com/point-of-sale/classic-library-deprecation/classic-library-integrations/c-library-integration/key-steps-c-library/cancel-or-refund-a-transaction-c-library/refund-a-transaction-from-the-pos-c.md" canonical: "https://docs.adyen.com/point-of-sale/classic-library-deprecation/classic-library-integrations/c-library-integration/key-steps-c-library/cancel-or-refund-a-transaction-c-library/refund-a-transaction-from-the-pos-c" last_modified: "2026-05-24T12:54:31+02:00" language: "en" --- # Refund a transaction from the POS [View source](/point-of-sale/classic-library-deprecation/classic-library-integrations/c-library-integration/key-steps-c-library/cancel-or-refund-a-transaction-c-library/refund-a-transaction-from-the-pos-c.md) ## 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](/point-of-sale/classic-library-deprecation/classic-library-integrations/c-library-integration/calls-and-callbacks-c-library/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. | Name | Description | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `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. |