--- title: "Book the remainder to your user" description: "Learn how to convert the currency of a refund and book the remainder to your user." url: "https://docs.adyen.com/platforms/online-payments/currency-conversion/refunds/your-user" source_url: "https://docs.adyen.com/platforms/online-payments/currency-conversion/refunds/your-user.md" canonical: "https://docs.adyen.com/platforms/online-payments/currency-conversion/refunds/your-user" last_modified: "2026-05-26T13:48:55+02:00" language: "en" --- # Book the remainder to your user Learn how to convert the currency of a refund and book the remainder to your user. [View source](/platforms/online-payments/currency-conversion/refunds/your-user.md) **Limited availability**\ Currency conversion in currently in pilot phase. Some of the processes and documentation may change as the feature evolves. If you are interested in piloting currency conversion or have any feedback, reach out to your Adyen contact. *** When you refund a payment with currency conversion, the refund amounts may not match the amounts in the original payment request, resulting in a remainder. For example, your user sold goods worth CZK 1000.00 to a customer who paid in PLN (PLN 201.74). Later, your user refunds the CZK 1000.00 to the customer, which results in a remainder of PLN 6.31. You can choose to book this remainder to your user. ## Booking options To book the remainder to your user, you have two options: * [Option 1: Use the amounts from the original payment request](#use-original-amounts). * [Option 2: Adjust the amount to be refunded in the settlement currency](#adjust-refund-amount-settlement-currency). When you book the remainder amount to your user: * The refund amount is fixed in the processing currency * The customer is credited the exact amount they originally paid in the processing currency * Your user is debited a different amount than what they originally received. This new amount is the sum of the original payment amount and the remainder. ## Requirements | Requirement | Description | | ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | You must have an Adyen [online payments integration and a checkout UI](/online-payments/build-your-integration). | | **[API credentials](/development-resources/api-credentials)** | You must have credentials for the following APIs:- [Checkout API](https://docs.adyen.com/api-explorer/Checkout/latest/overview) (format: **ws\@Company.\[YourCompanyAccount]**) - [Foreign Exchange API](https://docs.adyen.com/api-explorer/foreignexchange/latest/overview) (format: **ws\@BalancePlatform.\[YourBalancePlatform]**). Only for [option 2](#adjust-refund-amount-settlement-currency). | | **API credential roles** | Only for [option 2](#adjust-refund-amount-settlement-currency). To use the [Foreign Exchange API](https://docs.adyen.com/api-explorer/foreignexchange/latest/overview), make sure you have the following role:- **Read FX rates role** | | **[Webhooks](/development-resources/webhooks)** | Ensure that your server can receive and accept [standard webhooks](/development-resources/webhooks). Subscribe to any of the following webhooks:- [Transfer webhooks](https://docs.adyen.com/api-explorer/transfer-webhooks/latest/overview) - [Transaction webhooks](https://docs.adyen.com/api-explorer/transaction-webhooks/latest/overview) | | **[Capabilities](/platforms/verification-overview/capabilities)** | Make sure that your account holders have the following capabilities:- **receivePayments** - **receiveFromPlatformPayments** - **sendToTransferInstrument** | | **Setup steps** | Before you begin:- Ask our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to: * Enable the use of the [Foreign Exchange API](https://docs.adyen.com/api-explorer/foreignexchange/latest/overview) for your merchant account (only for [option 2](#adjust-refund-amount-settlement-currency)). * Configure the required currencies for your merchant account. - Your payment must be captured before you can initiate the refund. | ## How it works You process a payment with currency conversion on behalf of your user. The customer is debited in the processing currency and your user is credited in the settlement currency. When refunding this payment, you want to book the remainder to your user. This means that the refund amount is fixed in the processing currency, and any mismatch is booked to your user in the settlement currency. To refund this payment: 1. You calculate the amount the customer is refunded in the processing currency using the [/rates/calculate](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate) (only for [Option 2](#adjust-refund-amount-settlement-currency)). 2. You send a refund request, specifying the refund amount in both currencies. 3. When Adyen receives the request, we credit the customer and debit your user in their respective currencies. Your user is debited a different amount in the refund than what they originally received. ## Option 1: Use the amounts from the original payment request To book the remainder to your user's balance account, send a POST [/payments/{paymentPspReference}/refunds](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds) request. * Use the values from the original payment for the [amount](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-amount) and [splits.amount](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-splits-amount) objects of the request. For our example refund, this is PLN 201.74 for the `amount`, and CZK 1000.00 for the `splits.amount`. * In the splits array, add a split item for the remainder, with type **Remainder**. In the [account](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-splits-account) field of this split item, specify your user's balance account. You do not need to specify the amount of the remainder. When Adyen receives your request, we credit the customer with their original payment amount and book the remainder to the balance account you specified in the **Remainder** split item. ** #### Example refund request **Refund request where the remainder is booked to your user** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments/{paymentPspReference}/refunds \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "amount":{ "value":20174, "currency":"PLN" }, "reference":"YOUR_REFUND_REFERENCE", "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "splits":[ { "amount":{ "value":100000, "currency":"CZK" }, "type":"BalanceAccount", "account":"BA00000000000000000000001", "reference":"YOUR_SPLIT_REFERENCE", "description":"YOUR_SPLIT_DESCRIPTION" }, { "type":"Remainder", "account":"BA00000000000000000000001", "reference":"YOUR_REMAINDER_REFERENCE", "description":"YOUR_REMAINDER_DESCRIPTION" } ] }' ``` #### Java ```java // Adyen Java API Library v33.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the LIVE environment, also include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) SplitAmount splitAmount1 = new SplitAmount() .currency("CZK") .value(100000L); Amount amount = new Amount() .currency("PLN") .value(20174L); Split split1 = new Split() .reference("YOUR_SPLIT_REFERENCE") .amount(splitAmount1) .description("YOUR_SPLIT_DESCRIPTION") .type(Split.TypeEnum.BALANCEACCOUNT) .account("BA00000000000000000000001"); Split split2 = new Split() .reference("YOUR_REMAINDER_REFERENCE") .description("YOUR_REMAINDER_DESCRIPTION") .type(Split.TypeEnum.REMAINDER) .account("BA00000000000000000000001"); PaymentRefundRequest paymentRefundRequest = new PaymentRefundRequest() .reference("YOUR_REFUND_REFERENCE") .amount(amount) .splits(Arrays.asList(split1, split2)) .merchantAccount("YOUR_MERCHANT_ACCOUNT"); // Send the request ModificationsApi service = new ModificationsApi(client); PaymentRefundResponse response = service.refundCapturedPayment("paymentPspReference", paymentRefundRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php setXApiKey("ADYEN_API_KEY"); // For the LIVE environment, also include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $splitAmount1 = new SplitAmount(); $splitAmount1 ->setCurrency("CZK") ->setValue(100000); $amount = new Amount(); $amount ->setCurrency("PLN") ->setValue(20174); $split1 = new Split(); $split1 ->setReference("YOUR_SPLIT_REFERENCE") ->setAmount($splitAmount1) ->setDescription("YOUR_SPLIT_DESCRIPTION") ->setType("BalanceAccount") ->setAccount("BA00000000000000000000001"); $split2 = new Split(); $split2 ->setReference("YOUR_REMAINDER_REFERENCE") ->setDescription("YOUR_REMAINDER_DESCRIPTION") ->setType("Remainder") ->setAccount("BA00000000000000000000001"); $paymentRefundRequest = new PaymentRefundRequest(); $paymentRefundRequest ->setReference("YOUR_REFUND_REFERENCE") ->setAmount($amount) ->setSplits(array($split1, $split2)) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new ModificationsApi($client); $response = $service->refundCapturedPayment('paymentPspReference', $paymentRefundRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v28.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the LIVE environment, also include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) SplitAmount splitAmount1 = new SplitAmount { Currency = "CZK", Value = 100000 }; Amount amount = new Amount { Currency = "PLN", Value = 20174 }; Split split1 = new Split { Reference = "YOUR_SPLIT_REFERENCE", Amount = splitAmount1, Description = "YOUR_SPLIT_DESCRIPTION", Type = Split.TypeEnum.BalanceAccount, Account = "BA00000000000000000000001" }; Split split2 = new Split { Reference = "YOUR_REMAINDER_REFERENCE", Description = "YOUR_REMAINDER_DESCRIPTION", Type = Split.TypeEnum.Remainder, Account = "BA00000000000000000000001" }; PaymentRefundRequest paymentRefundRequest = new PaymentRefundRequest { Reference = "YOUR_REFUND_REFERENCE", Amount = amount, Splits = new List{ split1, split2 }, MerchantAccount = "YOUR_MERCHANT_ACCOUNT" }; // Send the request var service = new ModificationsService(client); var response = service.RefundCapturedPayment("paymentPspReference", paymentRefundRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v23.3.0 const { Client, CheckoutAPI } = require('@adyen/api-library'); // For the LIVE environment, also include your liveEndpointUrlPrefix. const client = new Client({ apiKey: "ADYEN_API_KEY", environment: "TEST" }); // Create the request object(s) const paymentRefundRequest = { amount: { value: 20174, currency: "PLN" }, reference: "YOUR_REFUND_REFERENCE", merchantAccount: "YOUR_MERCHANT_ACCOUNT", splits: [ { amount: { value: 100000, currency: "CZK" }, type: "BalanceAccount", account: "BA00000000000000000000001", reference: "YOUR_SPLIT_REFERENCE", description: "YOUR_SPLIT_DESCRIPTION" }, { type: "Remainder", account: "BA00000000000000000000001", reference: "YOUR_REMAINDER_REFERENCE", description: "YOUR_REMAINDER_DESCRIPTION" } ] } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.ModificationsApi.refundCapturedPayment("paymentPspReference", paymentRefundRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v17.0.0 import ( "context" "github.com/adyen/adyen-go-api-library/v17/src/common" "github.com/adyen/adyen-go-api-library/v17/src/adyen" "github.com/adyen/adyen-go-api-library/v17/src/checkout" ) // For the LIVE environment, also include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) splitAmount1 := checkout.SplitAmount{ Currency: common.PtrString("CZK"), Value: 100000, } amount := checkout.Amount{ Currency: "PLN", Value: 20174, } split1 := checkout.Split{ Reference: common.PtrString("YOUR_SPLIT_REFERENCE"), Amount: &splitAmount1, Description: common.PtrString("YOUR_SPLIT_DESCRIPTION"), Type: "BalanceAccount", Account: common.PtrString("BA00000000000000000000001"), } split2 := checkout.Split{ Reference: common.PtrString("YOUR_REMAINDER_REFERENCE"), Description: common.PtrString("YOUR_REMAINDER_DESCRIPTION"), Type: "Remainder", Account: common.PtrString("BA00000000000000000000001"), } paymentRefundRequest := checkout.PaymentRefundRequest{ Reference: common.PtrString("YOUR_REFUND_REFERENCE"), Amount: amount, Splits: []checkout.Split{ split1, split2, }, MerchantAccount: "YOUR_MERCHANT_ACCOUNT", } // Send the request service := client.Checkout() req := service.ModificationsApi.RefundCapturedPaymentInput("paymentPspReference").IdempotencyKey("UUID").PaymentRefundRequest(paymentRefundRequest) res, httpRes, err := service.ModificationsApi.RefundCapturedPayment(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v13.3.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "amount": { "value": 20174, "currency": "PLN" }, "reference": "YOUR_REFUND_REFERENCE", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "splits": [ { "amount": { "value": 100000, "currency": "CZK" }, "type": "BalanceAccount", "account": "BA00000000000000000000001", "reference": "YOUR_SPLIT_REFERENCE", "description": "YOUR_SPLIT_DESCRIPTION" }, { "type": "Remainder", "account": "BA00000000000000000000001", "reference": "YOUR_REMAINDER_REFERENCE", "description": "YOUR_REMAINDER_DESCRIPTION" } ] } # Send the request result = adyen.checkout.modifications_api.refund_captured_payment(request=json_request, paymentPspReference="paymentPspReference", idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v10.1.1 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :amount => { :value => 20174, :currency => 'PLN' }, :reference => 'YOUR_REFUND_REFERENCE', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :splits => [ { :amount => { :value => 100000, :currency => 'CZK' }, :type => 'BalanceAccount', :account => 'BA00000000000000000000001', :reference => 'YOUR_SPLIT_REFERENCE', :description => 'YOUR_SPLIT_DESCRIPTION' }, { :type => 'Remainder', :account => 'BA00000000000000000000001', :reference => 'YOUR_REMAINDER_REFERENCE', :description => 'YOUR_REMAINDER_DESCRIPTION' } ] } # Send the request result = adyen.checkout.modifications_api.refund_captured_payment(request_body, 'paymentPspReference', headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v23.3.0 import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // For the LIVE environment, also include your liveEndpointUrlPrefix. const client = new Client({ apiKey: "ADYEN_API_KEY", environment: "TEST" }); // Create the request object(s) const splitAmount1: Types.checkout.SplitAmount = { currency: "CZK", value: 100000 }; const amount: Types.checkout.Amount = { currency: "PLN", value: 20174 }; const split1: Types.checkout.Split = { reference: "YOUR_SPLIT_REFERENCE", amount: splitAmount1, description: "YOUR_SPLIT_DESCRIPTION", type: Types.checkout.Split.TypeEnum.BalanceAccount, account: "BA00000000000000000000001" }; const split2: Types.checkout.Split = { reference: "YOUR_REMAINDER_REFERENCE", description: "YOUR_REMAINDER_DESCRIPTION", type: Types.checkout.Split.TypeEnum.Remainder, account: "BA00000000000000000000001" }; const paymentRefundRequest: Types.checkout.PaymentRefundRequest = { reference: "YOUR_REFUND_REFERENCE", amount: amount, splits: [split1, split2], merchantAccount: "YOUR_MERCHANT_ACCOUNT" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.ModificationsApi.refundCapturedPayment("paymentPspReference", paymentRefundRequest, { idempotencyKey: "UUID" }); ``` You receive the following response: **Response** ```json { "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "paymentPspReference":"MNTQFKBDG3RZNN82", "pspReference":"NZK8QPBDG3RZNN82", "reference":"YOUR_REFUND_REFERENCE", "status":"received", "amount":{ "currency":"PLN", "value":20174 }, "splits":[ { "account":"BA00000000000000000000001", "amount":{ "currency":"CZK", "value":100000 }, "description":"YOUR_SPLIT_DESCRIPTION", "reference":"YOUR_SPLIT_REFERENCE", "type":"BalanceAccount" }, { "account":"BA00000000000000000000001", "description":"YOUR_REMAINDER_DESCRIPTION", "reference":"YOUR_REMAINDER_REFERENCE", "type":"Remainder" } ] } ``` ## Option 2: Adjust the amount to be refunded in the settlement currency To ensure that the customer receives the exact amount they originally paid in the processing currency, you can adjust the amount your user refunds in the settlement currency. ### Calculate the refund amount in the settlement currency To calculate the exact amount your user must refund in the settlement currency: 1. Contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to: * Enable the use of the [Foreign Exchange API](https://docs.adyen.com/api-explorer/foreignexchange/latest/overview) for your merchant account. * Configure the required currencies for your merchant account. 2. Make sure that you have the API key for the [Foreign Exchange API](https://docs.adyen.com/api-explorer/foreignexchange/latest/overview). Your credential has the format **ws\@BalancePlatform.\[YourBalancePlatform]**. 3. Make a POST [/rates/calculate](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate) request with an [exchangeCalculations](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations) array. Each item in the array defines a currency and value for which you want to perform a calculation. In each item of the array, specify: | Parameter | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | [type](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-type) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | Set to **splitRefund** | | [sourceAmount.currency](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-sourceAmount-currency) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The processing currency. | | [sourceAmount.value](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-sourceAmount-value) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The refund amount in the processing currency, in minor units. | | [targetCurrency](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-targetCurrency) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The settlement currency. | | [exchangeSide](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-exchangeSide) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The operation performed on the currency provided in the `sourceAmount.currency` field. Set this to **sell**. | 4. In the response, note the following fields: | Parameter | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | [type](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-type) | Returns **splitRefund** | | [exchangeSide](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-exchangeSide) | The operation performed on the currency provided in the `sourceAmount.currency` field. Returns **sell**. | | [sourceAmount.currency](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-sourceAmount-currency) | The processing currency. | | [sourceAmount.value](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-sourceAmount-value) | The refund amount in the processing currency, in minor units. | | [targetAmount.currency](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#responses-200-exchangeCalculations-targetAmount-currency) | The settlement currency. | | [targetAmount.value](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#responses-200-exchangeCalculations-targetAmount-value) | The refund amount in the settlement currency, in minor units. This is the amount your user refunds. | | [appliedExchangeRate](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#responses-200-exchangeCalculations-appliedExchangeRate) | The exchange rate to convert the processing currency to the settlement currency that includes Adyen's Markup. | ** #### Example request For example, your user sold goods worth CZK 1000.00 to a customer who paid in PLN (PLN 201.74). Later, your user refunds the CZK 1000.00 to the customer. Here: * The processing currency is PLN and the settlement currency is CZK. * The refund amount is fixed at PLN 201.74 (the processing currency). * You must calculate the refund amount in CZK (the settlement currency). This is the amount your user refunds. Here is a POST [/rates/calculate](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate) request to calculate the amount the customer receives in the refund, when the refund amount is fixed at PLN 201.74 (the processing currency). **Calculate the cost of goods in the processing currency** ```bash curl https://balanceplatform-api-live.adyen.com/fx/api/v1/rates/calculate \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "exchangeCalculations": [ { "type": "splitRefund", "sourceAmount": { "currency": "PLN" "value": 20174 }, "targetCurrency": "CZK", "exchangeSide": "sell" } ] }' ``` You receive the following response: **Response** ```json { "exchangeCalculations": [ { "type": "splitRefund", "exchangeSide": "sell", "sourceAmount": { "currency": "PLN", "value": 20174 }, "targetAmount": { "currency": "CZK", "value": "103231" }, "appliedExchangeRate": "0.20174" } ] } ``` The [targetAmount.value](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#responses-200-exchangeCalculations-targetAmount-value) field returns the adjusted amount in CZK that your user must refund in order for the customer to receive PLN 201.74 (the original payment amount). By increasing the amount your user refunds to CZK 1032.31, the customer will receive exactly PLN 201.74. Here, the remainder is the additional CZK 32.31 that you debit your user. You can include this adjusted refund amount in the `splits.amount.value` object of your refund request. ### Send a refund request To book the remainder to your user: 1. Make sure that you have the API key for the Checkout API. Your credential has the format **ws\@Company.\[YourCompanyAccount]**. 2. Send a POST [/payments/{paymentPspReference}/refunds](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds) request specifying the following fields for the currency conversion: | Parameter | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | | [amount.value](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-amount-value) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The original amount the customer paid in the processing currency. | **amount.value: 20174** | | [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-amount-currency) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The original processing currency. | **amount.currency: "PLN"** | | [splits.amount.value](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-splits-amount-value) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The adjusted refund amount in the settlement currency. In case of multiple splits, the sum of the split amounts in the splits array must equal the adjusted refund amount in the settlement currency. Any mismatch will be booked to the balance account you specify in the split item with type **Remainder**. | **splits.amount.value: 103231** | | [splits.amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-splits-amount-currency) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The original settlement currency. | **splits.amount.currency: "CZK"** | | [splits.type](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/refunds#request-splits-type) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The type of the split item. We recommend to always add a split item for the type **Remainder**. | **split.type: BalanceAccount** **split.type: Remainder** | 3. The splits are guaranteed, and the refund is booked according to the data you provide in the splits array. Any mismatch or miscalculation is booked to the balance account you specify in the split item with type **Remainder**. You can reconcile these mismatches per transaction using the [Balance Platform Accounting Report](/platforms/reports-and-fees/balance-platform-accounting-report). ** #### Example refund request **Refund request with adjusted refund amount in settlement currency** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments/{paymentPspReference}/refunds \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "amount":{ "value":20174, "currency":"PLN" }, "reference":"YOUR_REFUND_REFERENCE", "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "splits":[ { "amount":{ "value":103231, "currency":"CZK" }, "type":"BalanceAccount", "account":"BA00000000000000000000001", "reference":"YOUR_SPLIT_REFERENCE", "description":"YOUR_SPLIT_DESCRIPTION" }, { "type":"Remainder", "account":"BA00000000000000000000001", "reference":"YOUR_REMAINDER_REFERENCE", "description":"YOUR_REMAINDER_DESCRIPTION" } ] }' ``` #### Java ```java // Adyen Java API Library v33.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the LIVE environment, also include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) SplitAmount splitAmount1 = new SplitAmount() .currency("CZK") .value(103231L); Amount amount = new Amount() .currency("PLN") .value(20174L); Split split1 = new Split() .reference("YOUR_SPLIT_REFERENCE") .amount(splitAmount1) .description("YOUR_SPLIT_DESCRIPTION") .type(Split.TypeEnum.BALANCEACCOUNT) .account("BA00000000000000000000001"); Split split2 = new Split() .reference("YOUR_REMAINDER_REFERENCE") .description("YOUR_REMAINDER_DESCRIPTION") .type(Split.TypeEnum.REMAINDER) .account("BA00000000000000000000001"); PaymentRefundRequest paymentRefundRequest = new PaymentRefundRequest() .reference("YOUR_REFUND_REFERENCE") .amount(amount) .splits(Arrays.asList(split1, split2)) .merchantAccount("YOUR_MERCHANT_ACCOUNT"); // Send the request ModificationsApi service = new ModificationsApi(client); PaymentRefundResponse response = service.refundCapturedPayment("paymentPspReference", paymentRefundRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php setXApiKey("ADYEN_API_KEY"); // For the LIVE environment, also include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $splitAmount1 = new SplitAmount(); $splitAmount1 ->setCurrency("CZK") ->setValue(103231); $amount = new Amount(); $amount ->setCurrency("PLN") ->setValue(20174); $split1 = new Split(); $split1 ->setReference("YOUR_SPLIT_REFERENCE") ->setAmount($splitAmount1) ->setDescription("YOUR_SPLIT_DESCRIPTION") ->setType("BalanceAccount") ->setAccount("BA00000000000000000000001"); $split2 = new Split(); $split2 ->setReference("YOUR_REMAINDER_REFERENCE") ->setDescription("YOUR_REMAINDER_DESCRIPTION") ->setType("Remainder") ->setAccount("BA00000000000000000000001"); $paymentRefundRequest = new PaymentRefundRequest(); $paymentRefundRequest ->setReference("YOUR_REFUND_REFERENCE") ->setAmount($amount) ->setSplits(array($split1, $split2)) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new ModificationsApi($client); $response = $service->refundCapturedPayment('paymentPspReference', $paymentRefundRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v28.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the LIVE environment, also include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) SplitAmount splitAmount1 = new SplitAmount { Currency = "CZK", Value = 103231 }; Amount amount = new Amount { Currency = "PLN", Value = 20174 }; Split split1 = new Split { Reference = "YOUR_SPLIT_REFERENCE", Amount = splitAmount1, Description = "YOUR_SPLIT_DESCRIPTION", Type = Split.TypeEnum.BalanceAccount, Account = "BA00000000000000000000001" }; Split split2 = new Split { Reference = "YOUR_REMAINDER_REFERENCE", Description = "YOUR_REMAINDER_DESCRIPTION", Type = Split.TypeEnum.Remainder, Account = "BA00000000000000000000001" }; PaymentRefundRequest paymentRefundRequest = new PaymentRefundRequest { Reference = "YOUR_REFUND_REFERENCE", Amount = amount, Splits = new List{ split1, split2 }, MerchantAccount = "YOUR_MERCHANT_ACCOUNT" }; // Send the request var service = new ModificationsService(client); var response = service.RefundCapturedPayment("paymentPspReference", paymentRefundRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v23.3.0 const { Client, CheckoutAPI } = require('@adyen/api-library'); // For the LIVE environment, also include your liveEndpointUrlPrefix. const client = new Client({ apiKey: "ADYEN_API_KEY", environment: "TEST" }); // Create the request object(s) const paymentRefundRequest = { amount: { value: 20174, currency: "PLN" }, reference: "YOUR_REFUND_REFERENCE", merchantAccount: "YOUR_MERCHANT_ACCOUNT", splits: [ { amount: { value: 103231, currency: "CZK" }, type: "BalanceAccount", account: "BA00000000000000000000001", reference: "YOUR_SPLIT_REFERENCE", description: "YOUR_SPLIT_DESCRIPTION" }, { type: "Remainder", account: "BA00000000000000000000001", reference: "YOUR_REMAINDER_REFERENCE", description: "YOUR_REMAINDER_DESCRIPTION" } ] } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.ModificationsApi.refundCapturedPayment("paymentPspReference", paymentRefundRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v17.0.0 import ( "context" "github.com/adyen/adyen-go-api-library/v17/src/common" "github.com/adyen/adyen-go-api-library/v17/src/adyen" "github.com/adyen/adyen-go-api-library/v17/src/checkout" ) // For the LIVE environment, also include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) splitAmount1 := checkout.SplitAmount{ Currency: common.PtrString("CZK"), Value: 103231, } amount := checkout.Amount{ Currency: "PLN", Value: 20174, } split1 := checkout.Split{ Reference: common.PtrString("YOUR_SPLIT_REFERENCE"), Amount: &splitAmount1, Description: common.PtrString("YOUR_SPLIT_DESCRIPTION"), Type: "BalanceAccount", Account: common.PtrString("BA00000000000000000000001"), } split2 := checkout.Split{ Reference: common.PtrString("YOUR_REMAINDER_REFERENCE"), Description: common.PtrString("YOUR_REMAINDER_DESCRIPTION"), Type: "Remainder", Account: common.PtrString("BA00000000000000000000001"), } paymentRefundRequest := checkout.PaymentRefundRequest{ Reference: common.PtrString("YOUR_REFUND_REFERENCE"), Amount: amount, Splits: []checkout.Split{ split1, split2, }, MerchantAccount: "YOUR_MERCHANT_ACCOUNT", } // Send the request service := client.Checkout() req := service.ModificationsApi.RefundCapturedPaymentInput("paymentPspReference").IdempotencyKey("UUID").PaymentRefundRequest(paymentRefundRequest) res, httpRes, err := service.ModificationsApi.RefundCapturedPayment(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v13.3.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "amount": { "value": 20174, "currency": "PLN" }, "reference": "YOUR_REFUND_REFERENCE", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "splits": [ { "amount": { "value": 103231, "currency": "CZK" }, "type": "BalanceAccount", "account": "BA00000000000000000000001", "reference": "YOUR_SPLIT_REFERENCE", "description": "YOUR_SPLIT_DESCRIPTION" }, { "type": "Remainder", "account": "BA00000000000000000000001", "reference": "YOUR_REMAINDER_REFERENCE", "description": "YOUR_REMAINDER_DESCRIPTION" } ] } # Send the request result = adyen.checkout.modifications_api.refund_captured_payment(request=json_request, paymentPspReference="paymentPspReference", idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v10.1.1 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :amount => { :value => 20174, :currency => 'PLN' }, :reference => 'YOUR_REFUND_REFERENCE', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :splits => [ { :amount => { :value => 103231, :currency => 'CZK' }, :type => 'BalanceAccount', :account => 'BA00000000000000000000001', :reference => 'YOUR_SPLIT_REFERENCE', :description => 'YOUR_SPLIT_DESCRIPTION' }, { :type => 'Remainder', :account => 'BA00000000000000000000001', :reference => 'YOUR_REMAINDER_REFERENCE', :description => 'YOUR_REMAINDER_DESCRIPTION' } ] } # Send the request result = adyen.checkout.modifications_api.refund_captured_payment(request_body, 'paymentPspReference', headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v23.3.0 import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // For the LIVE environment, also include your liveEndpointUrlPrefix. const client = new Client({ apiKey: "ADYEN_API_KEY", environment: "TEST" }); // Create the request object(s) const splitAmount1: Types.checkout.SplitAmount = { currency: "CZK", value: 103231 }; const amount: Types.checkout.Amount = { currency: "PLN", value: 20174 }; const split1: Types.checkout.Split = { reference: "YOUR_SPLIT_REFERENCE", amount: splitAmount1, description: "YOUR_SPLIT_DESCRIPTION", type: Types.checkout.Split.TypeEnum.BalanceAccount, account: "BA00000000000000000000001" }; const split2: Types.checkout.Split = { reference: "YOUR_REMAINDER_REFERENCE", description: "YOUR_REMAINDER_DESCRIPTION", type: Types.checkout.Split.TypeEnum.Remainder, account: "BA00000000000000000000001" }; const paymentRefundRequest: Types.checkout.PaymentRefundRequest = { reference: "YOUR_REFUND_REFERENCE", amount: amount, splits: [split1, split2], merchantAccount: "YOUR_MERCHANT_ACCOUNT" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.ModificationsApi.refundCapturedPayment("paymentPspReference", paymentRefundRequest, { idempotencyKey: "UUID" }); ``` You receive the following response: **Response** ```json { "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "paymentPspReference":"CW2FJFC2BVTFWR82", "pspReference":"GFM9HGC2BVTFWR82", "reference":"YOUR_REFUND_REFERENCE", "status":"received", "amount":{ "currency":"PLN", "value":20174 }, "splits":[ { "account":"BA00000000000000000000001", "amount":{ "currency":"CZK", "value":103231 }, "description":"YOUR_SPLIT_DESCRIPTION", "reference":"YOUR_SPLIT_REFERENCE", "type":"BalanceAccount" }, { "account":"BA00000000000000000000001", "description":"YOUR_REMAINDER_DESCRIPTION", "reference":"YOUR_REMAINDER_REFERENCE", "type":"Remainder" } ] } ```