--- title: "Fix the cost of goods in the settlement currency" description: "Learn how to convert the currency of a payment when the cost of the goods is fixed in the settlement currency" url: "https://docs.adyen.com/platforms/online-payments/currency-conversion/payments/fix-settlement-currency" source_url: "https://docs.adyen.com/platforms/online-payments/currency-conversion/payments/fix-settlement-currency.md" canonical: "https://docs.adyen.com/platforms/online-payments/currency-conversion/payments/fix-settlement-currency" last_modified: "2023-02-10T14:17:00+01:00" language: "en" --- # Fix the cost of goods in the settlement currency Learn how to convert the currency of a payment when the cost of the goods is fixed in the settlement currency [View source](/platforms/online-payments/currency-conversion/payments/fix-settlement-currency.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 fix the cost of the goods in the settlement currency, your user always receives the same, fixed amount in their currency of choice (the settlement currency). The amount the customer pays in the processing currency is not fixed and depends on the prevailing exchange rate and Adyen's conversion markup. ## 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 if you are [using the `rates/calculate` endpoint](/platforms/online-payments/currency-conversion/payments/fix-settlement-currency/?tab=rates-api-settlement_1). | | **API credential roles** | To use the [Foreign Exchange API](/platforms/online-payments/currency-conversion/payments/fix-settlement-currency/?tab=rates-api-settlement_1), make sure you have the following role:- **Read FX rates role** | | **[Customer Area roles](/account/user-roles)** | To use the [Exchange Rate Report](/platforms/online-payments/currency-conversion/payments/fix-settlement-currency/?tab=exchange-rate-report-settlement_2), make sure that you have at least one of the following roles- **Merchant report** - **Merchant financial** - **Merchant admin** | | **[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 for your merchant account (only if you are [using the `rates/calculate` endpoint](/platforms/online-payments/currency-conversion/payments/fix-settlement-currency/?tab=rates-api-settlement_1)). * Configure the required currencies for your merchant account. | ## How it works If the cost of the goods in the settlement currency (the currency your user receives) is fixed: 1. [You calculate the amount the customer must pay in the processing currency, using either the Foreign Exchange API or the Exchange Rate Report](#calculate-the-amount-in-the-processing-currency). 2. [You make a POST `/payments` request, specifying the cost of the goods in both currencies](#send-a-payment-request-with-the-calculated-amount). 3. When Adyen receives the request, we debit the customer and credit your user in their respective currencies. ## Calculate the amount in the processing currency To calculate the exact amount the customer must pay in their currency of choice (the processing currency), you have two options: * Make a POST [/rates/calculate](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate) request using the Foreign Exchange API to get the exact payment amount in the processing currency. * Use our Exchange Rate Report to manually calculate the exact payment amount in the processing currency. ### Tab: Foreign Exchange API 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 **splitPayment** | | [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 settlement 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 cost of the goods in the settlement 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 processing 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 fixed currency (the currency provided in the `sourceAmount.currency` field. Set this to **buy**. | 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 **splitPayment** | | [exchangeSide](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-exchangeSide) | The operation performed on the fixed currency (the currency provided in the `sourceAmount.currency` field). Returns **buy**. | | [sourceAmount.currency](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-sourceAmount-currency) | The settlement currency. | | [sourceAmount.value](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#request-exchangeCalculations-sourceAmount-value) | The cost of the goods in the settlement currency, in minor units. | | [targetAmount.currency](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#responses-200-exchangeCalculations-targetAmount-currency) | The processing currency. | | [targetAmount.value](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#responses-200-exchangeCalculations-targetAmount-value) | The cost of the goods in the processing currency, in minor units. This is the amount the customer must pay. | | [appliedExchangeRate](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate#responses-200-exchangeCalculations-appliedExchangeRate) | The exchange rate to convert the settlement currency to the processing currency that includes Adyen's Markup. | ** #### Example request For example, your user sells goods worth CZK 1000.00 to a customer who pays in PLN. Here: * The processing currency is PLN and the settlement currency is CZK. * The cost of the goods is fixed in CZK (the settlement currency). * You must calculate the cost of the goods in PLN (the processing currency). This is the amount the customer must pay. Here is a POST [/rates/calculate](https://docs.adyen.com/api-explorer/foreignexchange/latest/post/rates/calculate) request to calculate the amount the customer must pay, when the cost of the goods is fixed at CZK 1000.00 (the settlement 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": "splitPayment", "sourceAmount": { "currency": "CZK" "value": 100000 }, "targetCurrency": "PLN", "exchangeSide": "buy" } ] }' ``` You receive the following response: **Response** ```json { "exchangeCalculations": [ { "type": "splitPayment", "exchangeSide": "sell", "sourceAmount": { "currency": "CZK", "value": 100000 }, "targetAmount": { "currency": "PLN", "value": "20174" }, "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 amount the customer must pay in PLN for your user to receive exactly CZK 1000.00. Here, the customer must pay PLN 201.74 in order for your user to receive CZK 1000.00. ### Tab: Exchange Rate Report 1. Make sure that you have at least one of the following [user roles](/account/user-roles): * Merchant report * Merchant financial * Merchant admin 2. Configure an additional column for the settlement exchange rate in the Exchange Rate Report: 1. Log in to your [Customer Area](https://ca-live.adyen.com/), and go to **Settings > Report columns**. 2. Find the **Exchange Rate Report** and select **Configure**. 3. Add the column **Exchange rate (platform Settlement)**, then select **Save configuration**. 3. Get the exchange rates for the day from the Exchange Rate Report. To do this: 1. Log in to your [Customer Area](https://ca-live.adyen.com/), and go to **Reports > Exchange rate**. 2. Select **Manage report** to generate the Exchange Rate Report for the day, or to enable automatic generation. Once generated, download the report. 3. In the report, under the column **Exchange rate (platform Settlement)**, find the rate to convert the settlement currency to the processing currency. The rates found in this report already include the conversion markup, which does not need to be added separately. 4. Use the following formula to calculate the cost of the goods in the processing currency, which is the amount the customer must pay: * The cost of goods in the processing currency =\ The cost of goods in the settlement currency × The exchange rate to convert the settlement currency to the processing currency ** #### Example calculation For example, your user sells goods worth CZK 1000.00 to a customer who pays in PLN. Here: * The processing currency is PLN and the settlement currency is CZK. * The cost of the goods is fixed in CZK (the settlement currency). * You must calculate the cost of the goods in PLN (the processing currency). This is the amount the customer must pay. To calculate the cost of the goods in the processing currency, use the prevailing exchange rate found in the Exchange Rate Report. In this example, the cost of the goods in the settlement currency is CZK 1000.00. According to the Exchange Rate Report, these are exchange rates for the day: | Base Currency | Target Currency | Exchange rate (platform Settlement) | | ------------- | --------------- | ----------------------------------- | | CZK | PLN | 0.20174 | | PLN | CZK | 5.07655 | Based on this table: * The exchange rate to convert CZK to PLN is 0.20174 * The exchange rate to convert PLN to CZK is 5.07655 Because these exchange rates include a conversion markup, they cannot be used interchangeably. For example:\ `(PLN to CZK exchange rate) ≠ 1 ÷ (CZK to PLN exchange rate)` For your user to receive exactly exactly CZK 1000.00, use the following formula to calculate the amount the customer needs to pay in PLN so that your user receives exactly CZK 1000.00: `(Cost of goods in CZK) × (Exchange rate to convert CZK to PLN) = (Cost of goods in PLN)` In our example:\ CZK 1000.00 × 0.20174 = PLN 201.74 The customer must pay PLN 201.74 in order for your user to receive CZK 1000.00. ## Send a payment request with the calculated amount 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](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments), [/sessions](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions), or [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) request, specifying the following fields for the currency conversion: | Parameter | Required | Description | Example | | ------------------------ | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- | | `amount.value` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The cost of the goods in the processing currency, calculated in [step 1](#1-calculate-the-amount-in-the-processing-currency). | **amount.value: 20174** | | `amount.currency` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The currency in which the customer pays. | **amount.currency: "PLN"** | | `splits.amount.value` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The cost of the goods in the settlement currency. In case of multiple splits, the sum of the split amounts in the splits array must equal the cost of the goods in the settlement currency. Any mismatch is booked to the balance account you specify in the split item with type **Remainder**. | **splits.amount.value: 100000** | | `splits.amount.currency` | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The settlement currency. This is the currency in which your user receives the funds. | **splits.amount.currency: "CZK"** | | `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 **Remainder** and the [transaction fees](/platforms/online-payments/transaction-fees). | **split.type: BalanceAccount** **split.type: PaymentFee** **split.type: Remainder** | **Payment request with currency conversion** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "paymentMethod": { "type": "scheme", "number": "4111111111111111", "cvc": "737", "expiryMonth": "03", "expiryYear": "2030", "holderName": "John Doe" }, "billingAddress": { "city":"London", "country":"GB", "houseNumberOrName":"10", "postalCode":"SW1A 2AA", "street":"Downing Street" }, "amount": { "value": 20174, "currency": "PLN" }, "reference": "YOUR_PAYMENT_REFERENCE", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "splits": [ { "type": "BalanceAccount", "account": "BA00000000000000000000001", "amount": { "currency": "CZK", "value": 100000 }, "reference": "YOUR_SPLIT_REFERENCE_1", "description": "YOUR_SPLIT_DESCRIPTION_1" }, { "type": "Remainder", "account": "BA00000000000000000000001", "reference": "YOUR_REMAINDER_REFERENCE", "description": "YOUR_REMAINDER_DESCRIPTION" }, { "type": "PaymentFee", "account": "BA00000000000000000000001", "reference": "YOUR_PAYMENT-FEE_REFERENCE", "description": "YOUR_PAYMENT-FEE_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_1") .amount(splitAmount1) .description("YOUR_SPLIT_DESCRIPTION_1") .type(Split.TypeEnum.BALANCEACCOUNT) .account("BA00000000000000000000001"); Split split2 = new Split() .reference("YOUR_REMAINDER_REFERENCE") .description("YOUR_REMAINDER_DESCRIPTION") .type(Split.TypeEnum.REMAINDER) .account("BA00000000000000000000001"); Split split3 = new Split() .reference("YOUR_PAYMENT-FEE_REFERENCE") .description("YOUR_PAYMENT-FEE_DESCRIPTION") .type(Split.TypeEnum.PAYMENTFEE) .account("BA00000000000000000000001"); CardDetails cardDetails = new CardDetails() .number("4111111111111111") .cvc("737") .holderName("John Doe") .expiryMonth("03") .expiryYear("2030") .type(CardDetails.TypeEnum.SCHEME); BillingAddress billingAddress = new BillingAddress() .country("GB") .city("London") .houseNumberOrName("10") .street("Downing Street") .postalCode("SW1A 2AA"); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_PAYMENT_REFERENCE") .amount(amount) .splits(Arrays.asList(split1, split2, split3)) .merchantAccount("YOUR_MERCHANT_ACCOUNT") .paymentMethod(new CheckoutPaymentMethod(cardDetails)) .billingAddress(billingAddress); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, 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_1") ->setAmount($splitAmount1) ->setDescription("YOUR_SPLIT_DESCRIPTION_1") ->setType("BalanceAccount") ->setAccount("BA00000000000000000000001"); $split2 = new Split(); $split2 ->setReference("YOUR_REMAINDER_REFERENCE") ->setDescription("YOUR_REMAINDER_DESCRIPTION") ->setType("Remainder") ->setAccount("BA00000000000000000000001"); $split3 = new Split(); $split3 ->setReference("YOUR_PAYMENT-FEE_REFERENCE") ->setDescription("YOUR_PAYMENT-FEE_DESCRIPTION") ->setType("PaymentFee") ->setAccount("BA00000000000000000000001"); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setNumber("4111111111111111") ->setCvc("737") ->setHolderName("John Doe") ->setExpiryMonth("03") ->setExpiryYear("2030") ->setType("scheme"); $billingAddress = new BillingAddress(); $billingAddress ->setCountry("GB") ->setCity("London") ->setHouseNumberOrName("10") ->setStreet("Downing Street") ->setPostalCode("SW1A 2AA"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_PAYMENT_REFERENCE") ->setAmount($amount) ->setSplits(array($split1, $split2, $split3)) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setPaymentMethod($checkoutPaymentMethod) ->setBillingAddress($billingAddress); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v27.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_1", Amount = splitAmount1, Description = "YOUR_SPLIT_DESCRIPTION_1", Type = Split.TypeEnum.BalanceAccount, Account = "BA00000000000000000000001" }; Split split2 = new Split { Reference = "YOUR_REMAINDER_REFERENCE", Description = "YOUR_REMAINDER_DESCRIPTION", Type = Split.TypeEnum.Remainder, Account = "BA00000000000000000000001" }; Split split3 = new Split { Reference = "YOUR_PAYMENT-FEE_REFERENCE", Description = "YOUR_PAYMENT-FEE_DESCRIPTION", Type = Split.TypeEnum.PaymentFee, Account = "BA00000000000000000000001" }; CardDetails cardDetails = new CardDetails { Number = "4111111111111111", Cvc = "737", HolderName = "John Doe", ExpiryMonth = "03", ExpiryYear = "2030", Type = CardDetails.TypeEnum.Scheme }; BillingAddress billingAddress = new BillingAddress { Country = "GB", City = "London", HouseNumberOrName = "10", Street = "Downing Street", PostalCode = "SW1A 2AA" }; PaymentRequest paymentRequest = new PaymentRequest { Reference = "YOUR_PAYMENT_REFERENCE", Amount = amount, Splits = new List{ split1, split2, split3 }, MerchantAccount = "YOUR_MERCHANT_ACCOUNT", PaymentMethod = new CheckoutPaymentMethod(cardDetails), BillingAddress = billingAddress }; // Send the request var service = new PaymentsService(client); var response = service.Payments(paymentRequest, 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 paymentRequest = { paymentMethod: { type: "scheme", number: "4111111111111111", cvc: "737", expiryMonth: "03", expiryYear: "2030", holderName: "John Doe" }, billingAddress: { city: "London", country: "GB", houseNumberOrName: "10", postalCode: "SW1A 2AA", street: "Downing Street" }, amount: { value: 20174, currency: "PLN" }, reference: "YOUR_PAYMENT_REFERENCE", merchantAccount: "YOUR_MERCHANT_ACCOUNT", splits: [ { type: "BalanceAccount", account: "BA00000000000000000000001", amount: { currency: "CZK", value: 100000 }, reference: "YOUR_SPLIT_REFERENCE_1", description: "YOUR_SPLIT_DESCRIPTION_1" }, { type: "Remainder", account: "BA00000000000000000000001", reference: "YOUR_REMAINDER_REFERENCE", description: "YOUR_REMAINDER_DESCRIPTION" }, { type: "PaymentFee", account: "BA00000000000000000000001", reference: "YOUR_PAYMENT-FEE_REFERENCE", description: "YOUR_PAYMENT-FEE_DESCRIPTION" } ] } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v16.3.0 import ( "context" "github.com/adyen/adyen-go-api-library/v16/src/common" "github.com/adyen/adyen-go-api-library/v16/src/adyen" "github.com/adyen/adyen-go-api-library/v16/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_1"), Amount: &splitAmount1, Description: common.PtrString("YOUR_SPLIT_DESCRIPTION_1"), 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"), } split3 := checkout.Split{ Reference: common.PtrString("YOUR_PAYMENT-FEE_REFERENCE"), Description: common.PtrString("YOUR_PAYMENT-FEE_DESCRIPTION"), Type: "PaymentFee", Account: common.PtrString("BA00000000000000000000001"), } cardDetails := checkout.CardDetails{ Number: common.PtrString("4111111111111111"), Cvc: common.PtrString("737"), HolderName: common.PtrString("John Doe"), ExpiryMonth: common.PtrString("03"), ExpiryYear: common.PtrString("2030"), Type: common.PtrString("scheme"), } billingAddress := checkout.BillingAddress{ Country: "GB", City: "London", HouseNumberOrName: "10", Street: "Downing Street", PostalCode: "SW1A 2AA", } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_PAYMENT_REFERENCE", Amount: amount, Splits: []checkout.Split{ split1, split2, split3, }, MerchantAccount: "YOUR_MERCHANT_ACCOUNT", PaymentMethod: checkout.CardDetailsAsCheckoutPaymentMethod(&cardDetails), BillingAddress: &billingAddress, } // Send the request service := client.Checkout() req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest) res, httpRes, err := service.PaymentsApi.Payments(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 = { "paymentMethod": { "type": "scheme", "number": "4111111111111111", "cvc": "737", "expiryMonth": "03", "expiryYear": "2030", "holderName": "John Doe" }, "billingAddress": { "city": "London", "country": "GB", "houseNumberOrName": "10", "postalCode": "SW1A 2AA", "street": "Downing Street" }, "amount": { "value": 20174, "currency": "PLN" }, "reference": "YOUR_PAYMENT_REFERENCE", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "splits": [ { "type": "BalanceAccount", "account": "BA00000000000000000000001", "amount": { "currency": "CZK", "value": 100000 }, "reference": "YOUR_SPLIT_REFERENCE_1", "description": "YOUR_SPLIT_DESCRIPTION_1" }, { "type": "Remainder", "account": "BA00000000000000000000001", "reference": "YOUR_REMAINDER_REFERENCE", "description": "YOUR_REMAINDER_DESCRIPTION" }, { "type": "PaymentFee", "account": "BA00000000000000000000001", "reference": "YOUR_PAYMENT-FEE_REFERENCE", "description": "YOUR_PAYMENT-FEE_DESCRIPTION" } ] } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, 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 = { :paymentMethod => { :type => 'scheme', :number => '4111111111111111', :cvc => '737', :expiryMonth => '03', :expiryYear => '2030', :holderName => 'John Doe' }, :billingAddress => { :city => 'London', :country => 'GB', :houseNumberOrName => '10', :postalCode => 'SW1A 2AA', :street => 'Downing Street' }, :amount => { :value => 20174, :currency => 'PLN' }, :reference => 'YOUR_PAYMENT_REFERENCE', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :splits => [ { :type => 'BalanceAccount', :account => 'BA00000000000000000000001', :amount => { :currency => 'CZK', :value => 100000 }, :reference => 'YOUR_SPLIT_REFERENCE_1', :description => 'YOUR_SPLIT_DESCRIPTION_1' }, { :type => 'Remainder', :account => 'BA00000000000000000000001', :reference => 'YOUR_REMAINDER_REFERENCE', :description => 'YOUR_REMAINDER_DESCRIPTION' }, { :type => 'PaymentFee', :account => 'BA00000000000000000000001', :reference => 'YOUR_PAYMENT-FEE_REFERENCE', :description => 'YOUR_PAYMENT-FEE_DESCRIPTION' } ] } # Send the request result = adyen.checkout.payments_api.payments(request_body, 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_1", amount: splitAmount1, description: "YOUR_SPLIT_DESCRIPTION_1", 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 split3: Types.checkout.Split = { reference: "YOUR_PAYMENT-FEE_REFERENCE", description: "YOUR_PAYMENT-FEE_DESCRIPTION", type: Types.checkout.Split.TypeEnum.PaymentFee, account: "BA00000000000000000000001" }; const cardDetails: Types.checkout.CardDetails = { number: "4111111111111111", cvc: "737", holderName: "John Doe", expiryMonth: "03", expiryYear: "2030", type: Types.checkout.CardDetails.TypeEnum.Scheme }; const billingAddress: Types.checkout.BillingAddress = { country: "GB", city: "London", houseNumberOrName: "10", street: "Downing Street", postalCode: "SW1A 2AA" }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_PAYMENT_REFERENCE", amount: amount, splits: [split1, split2, split3], merchantAccount: "YOUR_MERCHANT_ACCOUNT", paymentMethod: cardDetails, billingAddress: billingAddress }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` 3. You receive the following response: **Response** ```json { ... "pspReference":"LVP53Z9PQGNG5S82", "resultCode":"Authorised", "amount":{ "currency":"PLN", "value":20174 }, "merchantReference":"YOUR_PAYMENT_REFERENCE", "paymentMethod":{ "brand":"mc", "type":"scheme" } } ``` The splits are guaranteed, and the payment 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).