--- title: "Partially refund a balance" 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/partially-refund-a-balance-c-library" 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/partially-refund-a-balance-c-library.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/partially-refund-a-balance-c-library" last_modified: "2019-11-13T17:46:00+01:00" language: "en" --- # Partially refund a balance [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/partially-refund-a-balance-c-library.md) ## 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](/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 `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 | | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `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. |