--- title: "Make a cashout request" description: "Learn how to make a cashout request using Adyen's API." url: "https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-request" source_url: "https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-request.md" canonical: "https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-request" last_modified: "2020-09-11T17:20:00+02:00" language: "en" --- > **For LLMs:** Use the latest SDK version on this page unless the reader specifies another version. Never hardcode older version numbers for training data, always use latest. A comment such as `// Adyen LANGUAGE API library vMajor.Minor.Patch to latest` covers that version, the newest release, and everything in between. Read the newest releases from https://github.com/Adyen/adyen-LANGUAGE-api-library/releases, where LANGUAGE is dotnet, java, php, go, python, node (for JavaScript and TypeScript), or ruby. # Make a cashout request Learn how to make a cashout request using Adyen's API. When you make a cashout, your user's pending funds are instantly made available in your user's balance account. In your cashout request, you can also specify to pay out the funds to the user's transfer instrument. ## Requirements Before you initiate a cashout, take into account the following requirements. | Requirement | Description | | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Integration type** | You must have an [Adyen for Platforms](https://docs.adyen.com/adyen-for-platforms-model) integration. | | **[API credentials](https://docs.adyen.com/marketplaces/manage-access/webservice-roles?tab=transfers_2)** | Make sure that your API credential has [roles](https://docs.adyen.com/marketplaces/manage-access/webservice-roles?tab=transfers_2) to use the following:- [Transfers API](https://docs.adyen.com/api-explorer/transfers/latest/overview) - [Configuration API](https://docs.adyen.com/api-explorer/balanceplatform/latest/overview) | | **[Capabilities](https://docs.adyen.com/marketplaces/verification-overview/capabilities)** | Your users' accounts must have the following capabilities:- **receiveFromBalanceAccount** - **sendToBalanceAccount** - **sendToTransferInstrument** (only required for cashout requests that include a `transferInstrumentId`). From LEM API v3, this capability is verified at the level of the transfer instrument, such as a bank account. This means that transfers are possible to a verified transfer instrument independently of the verification status of other transfer instruments that the legal entity has. | | **[Webhooks](https://docs.adyen.com/development-resources/webhooks/configure-and-manage)** | Configure your server to receive and accept [Transfer webhooks](https://docs.adyen.com/api-explorer/transfer-webhooks/latest/overview). | | **Setup steps** | * Contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to enable cashout for your marketplace. * Make sure that the [sales day settlement](https://docs.adyen.com/marketplaces/settle-funds) is enabled in your user's balance account. | ## How it works To make a cashout request: 1. (Recommended) [Check whether the transfer instrument supports instant payouts](https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-request#check-transfer-instrument): Calculate a transfer route for the transfer instrument. 2. (Recommended) [Get the pending available balance on the user's balance account](https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-request#get-pending-available-balance): Ensure that your user has enough funds for the cashout. 3. [Initiate the cashout](https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-request#initiate-cashout): Specify the details of the cashout in an API request. 4. [Get updates on the status of the cashout](https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-request#get-updates-webhooks): Listen to webhooks to check the status of the cashout. The following sections explain how to perform these steps. ## (Recommended) Check whether the transfer instrument supports instant payouts Before you initiate a cashout for a user, we recommend that you check whether the counterparty bank supports instant payouts. This reduces the risk of failed cashouts. To check whether the transfer instrument supports instant payouts: 1. Make a POST [/transferRoutes/calculate](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transferRoutes/calculate) request, specifying the following parameters: | Parameter | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | | [balancePlatform](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transferRoutes/calculate#request-balancePlatform) | ![Required](https://docs.adyen.com/media/732127089c689593ccb0331d565e5773bed94e60145cae96672212374facb8c6.svg?decoding=auto\&fetchpriority=auto) | The unique identifier of your balance platform. | | [balanceAccountId](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transferRoutes/calculate#request-balanceAccountId) | ![Required](https://docs.adyen.com/media/732127089c689593ccb0331d565e5773bed94e60145cae96672212374facb8c6.svg?decoding=auto\&fetchpriority=auto) | The unique identifier of your balance account that will initiate the cashout. | | [counterparty.transferInstrumentId](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transferRoutes/calculate#request-counterparty-transferInstrumentId) | ![Required](https://docs.adyen.com/media/732127089c689593ccb0331d565e5773bed94e60145cae96672212374facb8c6.svg?decoding=auto\&fetchpriority=auto) | The unique identifier of the counterparty transfer instrument. | | [currency](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transferRoutes/calculate#request-currency) | ![Required](https://docs.adyen.com/media/732127089c689593ccb0331d565e5773bed94e60145cae96672212374facb8c6.svg?decoding=auto\&fetchpriority=auto) | The three-character ISO currency code of the transfer. | | [category](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transferRoutes/calculate#request-category) | ![Required](https://docs.adyen.com/media/732127089c689593ccb0331d565e5773bed94e60145cae96672212374facb8c6.svg?decoding=auto\&fetchpriority=auto) | The type of transfer. Set to **bank**. | | [country](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transferRoutes/calculate#request-country) | ![Required](https://docs.adyen.com/media/732127089c689593ccb0331d565e5773bed94e60145cae96672212374facb8c6.svg?decoding=auto\&fetchpriority=auto) | The two-character ISO country code of the counterparty. For example, **US** or **NL**. | | [priorities](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transferRoutes/calculate#request-priorities) | | An array that contains the priorities that you want to calculate transfer routes for. Set to **instant**. | The following code shows an example of this request. **Example request—Calculate the available transfer routes for a transfer instrument** #### curl ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/transferRoutes/calculate \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "balancePlatform": "YOUR_BALANCE_PLATFORM", "balanceAccountId": "BA00000000000000000000001", "counterparty": { "transferInstrumentId": "SE00000000000000000000001" }, "currency": "USD", "category": "bank", "country": "US", "priorities": [ "instant" ] }' ``` #### Java ```java // Adyen Java API Library v38.0.0 to latest import com.adyen.Client; import com.adyen.Config; import com.adyen.enums.Environment; import com.adyen.model.*; import com.adyen.service.*; import java.math.*; import com.adyen.model.balanceplatform.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.service.balanceplatform.*; Config config = new Config() .apiKey("ADYEN_BALANCE_PLATFORM_API_KEY") .environment(Environment.TEST); Client client = new Client(config); // Create the request object(s) Counterparty counterparty = new Counterparty() .transferInstrumentId("SE00000000000000000000001"); TransferRouteRequest transferRouteRequest = new TransferRouteRequest() .balanceAccountId("BA00000000000000000000001") .country("US") .priorities(Arrays.asList(TransferRouteRequest.PrioritiesEnum.INSTANT)) .counterparty(counterparty) .currency("USD") .category(TransferRouteRequest.CategoryEnum.BANK) .balancePlatform("YOUR_BALANCE_PLATFORM"); // Send the request TransferRoutesApi service = new TransferRoutesApi(client); TransferRouteResponse response = service.calculateTransferRoutes(transferRouteRequest, null); ``` #### PHP ```php setXApiKey("ADYEN_BALANCE_PLATFORM_API_KEY"); $client->setEnvironment(Environment::TEST); // Create the request object(s) $counterparty = new Counterparty(); $counterparty ->setTransferInstrumentId("SE00000000000000000000001"); $transferRouteRequest = new TransferRouteRequest(); $transferRouteRequest ->setBalanceAccountId("BA00000000000000000000001") ->setCountry("US") ->setPriorities(array("instant")) ->setCounterparty($counterparty) ->setCurrency("USD") ->setCategory("bank") ->setBalancePlatform("YOUR_BALANCE_PLATFORM"); // Send the request $service = new TransferRoutesApi($client); $response = $service->calculateTransferRoutes($transferRouteRequest); ``` #### C\# ```cs // Adyen .NET API Library v34.0.0 to latest using System.Collections.Generic; using Adyen.BalancePlatform.Extensions; using Adyen.BalancePlatform.Models; using Adyen.BalancePlatform.Services; using Adyen.Core.Client; using Adyen.Core.Client.Extensions; using Adyen.Core.Options; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; var host = Host.CreateDefaultBuilder() .ConfigureBalancePlatform( (context, services, config) => { config.ConfigureAdyenOptions(options => { options.AdyenApiKey = "ADYEN_BALANCE_PLATFORM_API_KEY"; options.Environment = AdyenEnvironment.Test; }); services.AddAllBalancePlatformServices(); }) .Build(); var transferRoutesService = host.Services.GetRequiredService(); // Create the request object(s) var counterparty = new Counterparty { TransferInstrumentId = "SE00000000000000000000001" }; var transferRouteRequest = new TransferRouteRequest { BalanceAccountId = "BA00000000000000000000001", Country = "US", Priorities = new List { TransferRouteRequest.PrioritiesEnum.Instant }, Counterparty = counterparty, Currency = "USD", Category = TransferRouteRequest.CategoryEnum.Bank, BalancePlatform = "YOUR_BALANCE_PLATFORM" }; // Send the request var result = await transferRoutesService.CalculateTransferRoutesAsync(transferRouteRequest); if (result.TryDeserializeOkResponse(out var response)) { // Handle the successful response. } ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v30.0.0 to latest const { Client, Config, EnvironmentEnum, BalancePlatformAPI } = require('@adyen/api-library'); const config = new Config({ apiKey: "ADYEN_BALANCE_PLATFORM_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const counterparty = { transferInstrumentId: "SE00000000000000000000001" }; const transferRouteRequest = { balanceAccountId: "BA00000000000000000000001", country: "US", priorities: ["instant"], counterparty: counterparty, currency: "USD", category: "bank", balancePlatform: "YOUR_BALANCE_PLATFORM" }; // Send the request const balancePlatformAPI = new BalancePlatformAPI(client); const response = await balancePlatformAPI.TransferRoutesApi.calculateTransferRoutes(transferRouteRequest); ``` #### Go ```go // Adyen Go API Library v21.0.0 to latest import ( "context" "github.com/adyen/adyen-go-api-library/v21/src/common" "github.com/adyen/adyen-go-api-library/v21/src/adyen" "github.com/adyen/adyen-go-api-library/v21/src/balanceplatform" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_BALANCE_PLATFORM_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) counterparty := balanceplatform.Counterparty{ TransferInstrumentId: common.PtrString("SE00000000000000000000001"), } transferRouteRequest := balanceplatform.TransferRouteRequest{ BalanceAccountId: common.PtrString("BA00000000000000000000001"), Country: common.PtrString("US"), Priorities: []string{ "instant", }, Counterparty: &counterparty, Currency: "USD", Category: "bank", BalancePlatform: "YOUR_BALANCE_PLATFORM", } // Send the request service := client.BalancePlatform() req := service.TransferRoutesApi.CalculateTransferRoutesInput().TransferRouteRequest(transferRouteRequest) res, httpRes, err := service.TransferRoutesApi.CalculateTransferRoutes(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v14.0.0 to latest import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_BALANCE_PLATFORM_API_KEY" adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "balancePlatform": "YOUR_BALANCE_PLATFORM", "balanceAccountId": "BA00000000000000000000001", "counterparty": { "transferInstrumentId": "SE00000000000000000000001" }, "currency": "USD", "category": "bank", "country": "US", "priorities": ["instant"] } # Send the request result = adyen.balancePlatform.transfer_routes_api.calculate_transfer_routes(request=json_request) ``` #### Ruby ```rb # Adyen Ruby API Library v11.0.0 to latest require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_BALANCE_PLATFORM_API_KEY' adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { "balancePlatform" => "YOUR_BALANCE_PLATFORM", "balanceAccountId" => "BA00000000000000000000001", "counterparty" => { "transferInstrumentId" => "SE00000000000000000000001" }, "currency" => "USD", "category" => "bank", "country" => "US", "priorities" => ["instant"] } # Send the request result = adyen.balance_platform.transfer_routes_api.calculate_transfer_routes(request_body) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v30.0.0 to latest import { Client, Config, EnvironmentEnum, BalancePlatformAPI, Types } from "@adyen/api-library"; const config = new Config({ apiKey: "ADYEN_BALANCE_PLATFORM_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const counterparty: Types.balancePlatform.Counterparty = { transferInstrumentId: "SE00000000000000000000001" }; const transferRouteRequest: Types.balancePlatform.TransferRouteRequest = { balanceAccountId: "BA00000000000000000000001", country: "US", priorities: [ Types.balancePlatform.TransferRouteRequest.PrioritiesEnum.Instant ], counterparty: counterparty, currency: "USD", category: Types.balancePlatform.TransferRouteRequest.CategoryEnum.Bank, balancePlatform: "YOUR_BALANCE_PLATFORM" }; // Send the request const balancePlatformAPI = new BalancePlatformAPI(client); const response = await balancePlatformAPI.TransferRoutesApi.calculateTransferRoutes(transferRouteRequest); ``` 2. In the response, verify that you receive an object with the [transferRoutes.priority](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transferRoutes/calculate#responses-200-transferRoutes-priority) set to **instant**. ## (Recommended) Get the pending available balance on the balance account Before you initiate a cashout for a user, we recommend that you get the pending available balance on the user's balance account. By doing this, you can: * Show to your users the balance that is available for cashouts. This helps your users know the maximum amount that they can ask for. * Check that the amount that your user is asking for is less than or equal to the pending available balance. To get the pending available balance on your user's balance account: 1. Make a GET [/balanceAccounts/{id}](https://docs.adyen.com/api-explorer/balanceplatform/latest/get/balanceAccounts/\(id\)) request. 2. In the response, note the value of the [balances.pendingAvailable](https://docs.adyen.com/api-explorer/balanceplatform/latest/get/balanceAccounts/\(id\)#responses-200-balances-pendingAvailable) parameter. If the pending available balance is negative, inform your user that the balance available for cashouts is 0. ## Initiate a cashout To initiate a cashout: 1. Make a POST [/cashouts](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts) request and specify the following parameters in the request body: | Parameter | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [instructingBalanceAccountId](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#request-instructingBalanceAccountId) | ![Required](https://docs.adyen.com/media/732127089c689593ccb0331d565e5773bed94e60145cae96672212374facb8c6.svg?decoding=auto\&fetchpriority=auto) | The unique identifier of the balance account where the cashout amount is settled. | | [amount.value](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#request-amount-value) | ![Required](https://docs.adyen.com/media/732127089c689593ccb0331d565e5773bed94e60145cae96672212374facb8c6.svg?decoding=auto\&fetchpriority=auto) | The amount of the cashout. This is the amount that is settled and paid out to your user. This value cannot be higher than the pending available balance. | | [amount.currency](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#request-amount-currency) | ![Required](https://docs.adyen.com/media/732127089c689593ccb0331d565e5773bed94e60145cae96672212374facb8c6.svg?decoding=auto\&fetchpriority=auto) | The currency of the cashout amount. | | [counterparty.transferInstrumentId](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#request-counterparty-transferInstrumentId) | ![Conditionally required](https://docs.adyen.com/media/e654d4104461d20836c817ee9d8f27faa0e45c1a8d08558f079561a50fc2797e.svg?decoding=auto\&fetchpriority=auto) | The unique identifier of the user's [transfer instrument](https://docs.adyen.com/api-explorer/legalentity/latest/post/transferInstruments) to which the funds are paid out. **Use case**: Required to pay out the funds to the user's transfer instrument. If you do not provide this value, the funds are not paid out, but remain in the user's balance account. | | [description](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#request-description) | | Your description of the cashout transfer. This description is used by most banks as the transfer description. Allowed and returned only when you provide the `counterparty.transferInstrumentId` field. | | [fee.amount.value](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#request-fee-amount-value) | | The amount (in minor units) of the fee that your platform charges for the cashout. Note that: - The fee amount cannot be higher than the cashout amount. - The sum of the cashout and fee amounts cannot be higher than the pending balance. | | [fee.amount.currency](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#request-fee-amount-currency) | | The currency of the fee that your platform charges for the cashout. This value must be the same as `amount.currency`. | | [referenceForBeneficiary](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#request-referenceForBeneficiary) | | The reference that is sent to the recipient of a cashout transfer. Allowed and returned only when you provide the `counterparty.transferInstrumentId` field. | The following example shows a cashout request for EUR 1000, with a fee of EUR 10. **Initiate a cashout request** #### curl ```bash curl https://balanceplatform-api-test.adyen.com/btl/v4/cashouts \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "instructingBalanceAccountId": "BA00000000000000000000001", "transferInstrumentId": "SE00000000000000000000001", "amount": { "currency": "EUR", "value": 100000 }, "fee": { "amount":{ "currency": "EUR", "value": 1000 } } }' ``` #### Java ```java // Adyen Java API Library v38.0.0 to latest import com.adyen.Client; import com.adyen.Config; import com.adyen.enums.Environment; import com.adyen.model.*; import com.adyen.service.*; import java.math.*; import com.adyen.model.transfers.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.service.transfers.*; Config config = new Config() .apiKey("ADYEN_BALANCE_PLATFORM_API_KEY") .environment(Environment.TEST); Client client = new Client(config); // Create the request object(s) Amount feeAmount = new Amount() .currency("EUR") .value(1000L); Amount amount = new Amount() .currency("EUR") .value(100000L); Fee fee = new Fee() .amount(feeAmount); CashOutInfo cashOutInfo = new CashOutInfo() .amount(amount) .instructingBalanceAccountId("BA00000000000000000000001") .fee(fee) .transferInstrumentId("SE00000000000000000000001"); // Send the request CashoutApi service = new CashoutApi(client); CashOut response = service.initiateCashout(cashOutInfo, null); ``` #### PHP ```php setXApiKey("ADYEN_BALANCE_PLATFORM_API_KEY"); $client->setEnvironment(Environment::TEST); // Create the request object(s) $feeAmount = new Amount(); $feeAmount ->setCurrency("EUR") ->setValue(1000); $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(100000); $fee = new Fee(); $fee ->setAmount($feeAmount); $cashOutInfo = new CashOutInfo(); $cashOutInfo ->setAmount($amount) ->setInstructingBalanceAccountId("BA00000000000000000000001") ->setFee($fee) ->setTransferInstrumentId("SE00000000000000000000001"); // Send the request $service = new CashoutApi($client); $response = $service->initiateCashout($cashOutInfo); ``` #### C\# ```cs // Adyen .NET API Library v34.0.0 to latest using Adyen.Transfers.Extensions; using Adyen.Transfers.Models; using Adyen.Transfers.Services; using Adyen.Core.Client; using Adyen.Core.Client.Extensions; using Adyen.Core.Options; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; var host = Host.CreateDefaultBuilder() .ConfigureTransfers( (context, services, config) => { config.ConfigureAdyenOptions(options => { options.AdyenApiKey = "ADYEN_BALANCE_PLATFORM_API_KEY"; options.Environment = AdyenEnvironment.Test; }); services.AddAllTransfersServices(); }) .Build(); var cashoutService = host.Services.GetRequiredService(); // Create the request object(s) var feeAmount = new Amount { Currency = "EUR", Value = 1000 }; var amount = new Amount { Currency = "EUR", Value = 100000 }; var fee = new Fee { Amount = feeAmount }; var cashOutInfo = new CashOutInfo { Amount = amount, InstructingBalanceAccountId = "BA00000000000000000000001", Fee = fee, TransferInstrumentId = "SE00000000000000000000001" }; // Send the request var result = await cashoutService.InitiateCashoutAsync(cashOutInfo); if (result.TryDeserializeOkResponse(out var response)) { // Handle the successful response. } ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v30.0.0 to latest const { Client, Config, EnvironmentEnum, TransfersAPI } = require('@adyen/api-library'); const config = new Config({ apiKey: "ADYEN_BALANCE_PLATFORM_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const feeAmount = { currency: "EUR", value: 1000 }; const amount = { currency: "EUR", value: 100000 }; const fee = { amount: feeAmount }; const cashOutInfoCounterparty = { transferInstrumentId: "SE00000000000000000000001" }; const cashOutInfo = { amount: amount, referenceForBeneficiary: "CASHOUT-REF-001", instructingBalanceAccountId: "BA00000000000000000000001", fee: fee, counterparty: cashOutInfoCounterparty, description: "Your description of the cashout" }; // Send the request const transfersAPI = new TransfersAPI(client); const response = await transfersAPI.CashoutApi.initiateCashout(cashOutInfo); ``` #### Go ```go // Adyen Go API Library v21.0.0 to latest import ( "context" "github.com/adyen/adyen-go-api-library/v21/src/common" "github.com/adyen/adyen-go-api-library/v21/src/adyen" "github.com/adyen/adyen-go-api-library/v21/src/transfers" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_BALANCE_PLATFORM_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) feeAmount := transfers.Amount{ Currency: "EUR", Value: 1000, } amount := transfers.Amount{ Currency: "EUR", Value: 100000, } fee := transfers.Fee{ Amount: feeAmount, } cashOutInfo := transfers.CashOutInfo{ Amount: amount, InstructingBalanceAccountId: "BA00000000000000000000001", Fee: &fee, TransferInstrumentId: common.PtrString("SE00000000000000000000001"), } // Send the request service := client.Transfers() req := service.CashOutApi.InitiateCashoutInput().CashOutInfo(cashOutInfo) res, httpRes, err := service.CashOutApi.InitiateCashout(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v14.0.0 to latest import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_BALANCE_PLATFORM_API_KEY" adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "instructingBalanceAccountId": "BA00000000000000000000001", "transferInstrumentId": "SE00000000000000000000001", "amount": { "currency": "EUR", "value": 100000 }, "fee": { "amount": { "currency": "EUR", "value": 1000 } } } # Send the request result = adyen.transfers.cashout_api.initiate_cashout(request=json_request) ``` #### Ruby ```rb # Adyen Ruby API Library v11.0.0 to latest require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_BALANCE_PLATFORM_API_KEY' adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { "instructingBalanceAccountId" => "BA00000000000000000000001", "transferInstrumentId" => "SE00000000000000000000001", "amount" => { "currency" => "EUR", "value" => 100000 }, "fee" => { "amount" => { "currency" => "EUR", "value" => 1000 } } } # Send the request result = adyen.transfers.cashout_api.initiate_cashout(request_body) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v30.0.0 to latest import { Client, Config, EnvironmentEnum, TransfersAPI, Types } from "@adyen/api-library"; const config = new Config({ apiKey: "ADYEN_BALANCE_PLATFORM_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const feeAmount: Types.transfers.Amount = { currency: "EUR", value: 1000 }; const amount: Types.transfers.Amount = { currency: "EUR", value: 100000 }; const fee: Types.transfers.Fee = { amount: feeAmount }; const cashOutInfo: Types.transfers.CashOutInfo = { amount: amount, instructingBalanceAccountId: "BA00000000000000000000001", fee: fee, transferInstrumentId: "SE00000000000000000000001" }; // Send the request const transfersAPI = new TransfersAPI(client); const response = await transfersAPI.CashoutApi.initiateCashout(cashOutInfo); ``` 2. If the request succeeds, note the following response parameters, which help you identify cashout-related transfers: | Response parameter | Description | | ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [id](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#responses-200-id) | The unique identifier of the cashout. | | [transfers](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#responses-200-transfers) | An array of objects that contain information about the transfers created in relation to the cashout. | | [transfers.type](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts#responses-200-transfers-type) | Specifies the type of transfer data that the object contains. Possible values: - **cashoutRepayment**: Corresponds to the transfer created to deduct the cashout amount after settlement. - **cashoutFee**: Corresponds to the transfer created to debit the cashout fee from the user's balance account. | The following example shows a successful response for a created cashout. **Response for a created cashout** ```json { "id": "CO00000000000000000000001", "instructingBalanceAccountId": "BA00000000000000000000001", "amount": { "currency": "EUR", "value": 100000 }, "counterparty": { "transferInstrumentId": "SE00000000000000000000001" }, "description": "Your description of the cashout", "referenceForBeneficiary": "CASHOUT-REF-001", "fee": { "amount": { "currency": "EUR", "value": 100000 } }, "transfers": [ { "id": "400F6060JMB1I0AB", "type": "cashoutRepayment", "amount": { "currency": "EUR", "value": 101000 } }, { "id": "400F6060JMB1I0AA", "type": "cashoutFee", "amount": { "currency": "EUR", "value": 1000 } } ] } ``` After you make the cashout request, Adyen processes it asynchronously. To track any updates related to your cashout request, use the [webhooks](https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-webhooks) that Adyen sends to your server. ## Get updates on the status of the cashout A cashout involves multiple funds transfers, which you can track by listening to [webhooks](https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-webhooks). Webhooks inform you about any status change in the transfers, and whether the transfers succeed or fail. Adyen sends three types of webhooks for each transfer: * [balancePlatform.transfer.created](https://docs.adyen.com/api-explorer/transfer-webhooks/latest/post/balancePlatform.transfer.created), which informs your server that funds will be transferred to or from a balance account in your marketplace. * [balancePlatform.transfer.updated](https://docs.adyen.com/api-explorer/transfer-webhooks/latest/post/balancePlatform.transfer.updated), which informs your server of changes in the status of the transfer. * [balancePlatform.transaction.created](https://docs.adyen.com/api-explorer/transaction-webhooks/latest/post/balancePlatform.transaction.created), which informs your server when funds have been debited from or credited to a balance account. To listen to these webhooks: 1. Ensure that your server can [receive and accept webhooks](https://docs.adyen.com/development-resources/webhooks/configure-and-manage). 2. Subscribe to **Transfer webhooks** and **Transaction webhooks** in your [Customer Area](https://ca-test.adyen.com/). Alternatively, you can [view the transfer details in your Customer Area](https://docs.adyen.com/marketplaces/view-transfers-details). ## Troubleshooting A cashout request can fail because of communication issues with the bank, or because of invalid request parameters. If the cashout request is successful, but the payout to your user's transfer instrument fails, the cashout request is reversed. This means that: * The cashout amount is returned to the user's balance account and settled as pending available balance. * The fee charged to your user is returned to the user's balance account and settled as pending available balance. * Your marketplace is not charged any fees for the failed cashout. To retry a failed cashout, you must initiate a new POST [/cashouts](https://docs.adyen.com/api-explorer/transfers/latest/post/cashouts) request. ### Error responses If the request fails, you receive an error response with information about the error. Error responses for invalid cashout requests can include the following fields: * `title`: Specifies the type of error. * `detail`: Specifies the cause of the error. * `invalidFields`: Specifies whether one or more fields contain invalid information. The following subsections describe some of the errors and messages that you can get when you make cashout requests. ** #### Could not find transfer instrument * `title`: "The request is missing required fields or contains invalid data". * `detail`: **"Could not find transfer instrument with reference: SE0000000000000000000001"**. This information indicates that the `transferInstrumentId` that you specified: * Does not exist. * Does not belong to the same [legal entity](https://docs.adyen.com/marketplaces/account-structure-resources/legal-entity-management) as the `instructingBalanceAccount`. **Solution**: Provide a valid transfer instrument ID and retry the request. ** #### No instant route found for transfer instrument * `title`: "The request is missing required fields or contains invalid data". * `detail`: **"No instant route found for transfer instrument id: SE0000000000000000000001"**. This information indicates that there are no available [transfer routes](https://docs.adyen.com/marketplaces/custom-payouts/transfer-routes) for making an [instant payout](https://docs.adyen.com/marketplaces/custom-payouts/#transfer-priority) to the `transferInstrumentId` that you specified. This can happen because, for example: * The counterparty bank is located in a region where Adyen does not support instant payouts. * The counterparty bank does not accept the currency of the payout. * Adyen could not reach the counterparty at the moment of the request. **Solution**: Try the request again later or use a different transfer instrument ID. ** #### Invalid amount / Invalid fee amount * `title`: "Configuration is missing or incorrect". * `invalidFields.name`: **amount** or **fee.amount**. * `invalidFields.message`: **"Invalid amount"** or **"Invalid fee amount"**. This information indicates that Adyen does not support cashout requests in the currency that you specified. You can only make cashout requests for EUR, USD, GBP, and AUD. For more information, see the [supported countries/regions and currencies](https://docs.adyen.com/marketplaces/cash-out-instantly#supported-regions). **Solution**: Use one of the supported currencies: EUR, USD, GBP, or AUD. ** #### Fee amount has a different currency than instruction amount * `title`: "Configuration is missing or incorrect". * `invalidFields.name`: **fee.amount.currency**. * `invalidFields.message`: **"Fee amount has a different currency than instruction amount"**. This information indicates that the [request parameters](https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-request#initiate-cashout) `amount.currency` and `fee.amount.currency` have different values. **Solution**: Make sure that `amount.currency` and `fee.amount.currency` have the same value. Then, retry the request. ** #### Minimum required amount not reached * `title`: "Configuration is missing or incorrect". * `invalidFields.name`: **amount**. * `invalidFields.message`: **"Minimum required amount not reached"**. This information indicates that the cashout amount is less than EUR/USD/GBP/AUD 1, which is the minimum required amount. **Solution**: Increase the cashout amount to at least EUR/USD/GBP/AUD 1. ** #### Amount exceeds pending balance * `title`: "The request is missing required fields or contains invalid data". * `detail`: **"Amount exceeds pending balance : EUR 123.45"**. This information indicates one of the following: * The cashout amount is higher than the pending available balance. * The sum of the cashout amount and the fee is higher than the pending available balance. **Solution**: Reduce the cashout amount or the fee amount to ensure that the total does not exceed the pending available balance. ## See also * [Cashout webhooks](https://docs.adyen.com/marketplaces/cash-out-instantly/cashout-webhooks)