Change Fee Target Account
curl --request POST \
--url https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant_fee": 123,
"fee_wallet": true
}
'import requests
url = "https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target"
payload = {
"merchant_fee": 123,
"fee_wallet": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({merchant_fee: 123, fee_wallet: true})
};
fetch('https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'merchant_fee' => 123,
'fee_wallet' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target"
payload := strings.NewReader("{\n \"merchant_fee\": 123,\n \"fee_wallet\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"merchant_fee\": 123,\n \"fee_wallet\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchant_fee\": 123,\n \"fee_wallet\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 0,
"merchant_id": 0,
"recipient_id": 0,
"currency_id": 0,
"account_fee": {
"id": 0,
"merchant_id": 0,
"currency_id": 0,
"use_fee_billing": true
}
}
{
"error": "Unauthorized"
}
{
"error": "Internal server error"
}
Account
Change Fee Target Account
Transfer Cashout fee from one account to another within the same customer domain
POST
/
v2
/
account
/
{merchantId}
/
fee-target
Change Fee Target Account
curl --request POST \
--url https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant_fee": 123,
"fee_wallet": true
}
'import requests
url = "https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target"
payload = {
"merchant_fee": 123,
"fee_wallet": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({merchant_fee: 123, fee_wallet: true})
};
fetch('https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'merchant_fee' => 123,
'fee_wallet' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target"
payload := strings.NewReader("{\n \"merchant_fee\": 123,\n \"fee_wallet\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"merchant_fee\": 123,\n \"fee_wallet\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchant_fee\": 123,\n \"fee_wallet\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 0,
"merchant_id": 0,
"recipient_id": 0,
"currency_id": 0,
"account_fee": {
"id": 0,
"merchant_id": 0,
"currency_id": 0,
"use_fee_billing": true
}
}
{
"error": "Unauthorized"
}
{
"error": "Internal server error"
}
This endpoint allows the transfer of a Cashout fee (Payout/Cashout fee) to another account within the same customer domain. This functionality is useful when fee charges need to be reallocated between internal accounts belonging to the same customer (e.g., between segregated wallets or cost centers).
Business Rules
Important Restrictions:
- The target account must belong to the same customer domain as the original account
- After the transfer, the fee becomes exclusively associated with the new account, but it remains linked to the originating entity of the fee
- Fees related to Payin/Cashin transactions are not affected by this functionality — they will continue to be charged to the originating account (i.e., the account where the Cashin occurred)
Note: This setting only defines which wallet will be charged the merchant fee, but it does not change the operational model (prepaid or postpaid) of the merchant itself.
Prepaid Model
The destination wallet must have sufficient balance at the time of the fee charge.Postpaid Model
The destination wallet does not need to have sufficient balance, but all fees will be consolidated and invoiced monthly by the WEpayments finance team.About Removing This Setting
Update as of 2023-06-11: Currently, this removal cannot be performed via API. If you need to remove this configuration, please contact our CA team to request the change. In the coming weeks, new account management endpoints will be made available to support this functionality, eliminating the need to open a support ticket with our CA team.
Path Parameters
string
required
Merchant ID
Request Body
integer
required
Provide the ID of the account that should receive the fees from the account you are updating (the account specified in the endpoint path).Important: Your “Free fee” to be charged to the destination account should be posted to the fee wallet.
boolean
Indicate “true” if the fee to be charged to the destination account should be posted to the fee wallet.
Response
integer
Account ID
integer
Merchant ID
integer or null
Recipient ID
integer
Currency ID
object or null
Account fee configuration
integer
Fee configuration ID
integer
Merchant ID
integer
Currency ID
boolean
Whether fee billing is enabled
Request Example
curl --request POST \
--url https://api.sandbox.wepayout.com.br/v2/account/{merchantId}/fee-target \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"merchant_fee": 1234,
"fee_wallet": true
}'
const merchantId = 'your_merchant_id';
const response = await fetch(
`https://api.wepayments.com/v2/account/${merchantId}/fee-target`,
{
method: 'POST',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
merchant_fee: 123,
fee_wallet: true
})
}
);
const data = await response.json();
console.log('Fee target updated:', data);
import requests
merchant_id = 'your_merchant_id'
url = f'https://api.wepayments.com/v2/account/{merchant_id}/fee-target'
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
data = {
'merchant_fee': 123,
'fee_wallet': True
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(f"Fee target updated: {result}")
{
"id": 0,
"merchant_id": 0,
"recipient_id": 0,
"currency_id": 0,
"account_fee": {
"id": 0,
"merchant_id": 0,
"currency_id": 0,
"use_fee_billing": true
}
}
{
"error": "Unauthorized"
}
{
"error": "Internal server error"
}
Use Cases
Centralize Fee Management
Centralize Fee Management
Route all fees to a dedicated fee management account:
async function centralizeFees(merchantId, feeAccountId) {
const response = await fetch(
`https://api.wepayments.com/v2/account/${merchantId}/fee-target`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
merchant_fee: feeAccountId,
fee_wallet: true
})
}
);
return await response.json();
}
// Route all fees from account 456 to central fee account 789
await centralizeFees(456, 789);
Cost Center Allocation
Cost Center Allocation
Allocate fees to specific cost centers:
async function allocateFeesToCostCenter(accounts, costCenterId) {
const results = [];
for (const accountId of accounts) {
const result = await fetch(
`https://api.wepayments.com/v2/account/${accountId}/fee-target`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
merchant_fee: costCenterId,
fee_wallet: true
})
}
);
results.push({
accountId,
status: result.status,
data: await result.json()
});
}
return results;
}
// Allocate fees from multiple accounts to cost center
const accounts = [101, 102, 103];
await allocateFeesToCostCenter(accounts, 999);
Segregated Wallet Management
Segregated Wallet Management
Manage fees across segregated wallets:
async function setupSegregatedWalletFees(mainWalletId, feeWalletId) {
// Configure main wallet to send fees to fee wallet
const response = await fetch(
`https://api.wepayments.com/v2/account/${mainWalletId}/fee-target`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
merchant_fee: feeWalletId,
fee_wallet: true
})
}
);
const result = await response.json();
return {
mainWallet: mainWalletId,
feeWallet: feeWalletId,
configuration: result
};
}
Multi-Account Fee Routing
Multi-Account Fee Routing
Set up fee routing for multiple accounts:
async function setupMultiAccountFeeRouting(feeRoutingConfig) {
const results = [];
for (const config of feeRoutingConfig) {
try {
const response = await fetch(
`https://api.wepayments.com/v2/account/${config.sourceAccount}/fee-target`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
merchant_fee: config.targetAccount,
fee_wallet: config.useFeeWallet
})
}
);
results.push({
source: config.sourceAccount,
target: config.targetAccount,
success: response.ok,
data: await response.json()
});
} catch (error) {
results.push({
source: config.sourceAccount,
target: config.targetAccount,
success: false,
error: error.message
});
}
}
return results;
}
// Usage
const config = [
{ sourceAccount: 101, targetAccount: 201, useFeeWallet: true },
{ sourceAccount: 102, targetAccount: 201, useFeeWallet: true },
{ sourceAccount: 103, targetAccount: 202, useFeeWallet: false }
];
const results = await setupMultiAccountFeeRouting(config);
console.log('Fee routing setup:', results);
Important Considerations
Fee Types Affected
Affected
Cashout/Payout Fees
- Withdrawal fees
- Transfer fees
- Payout processing fees
Not Affected
Cashin/Payin Fees
- Deposit fees
- Payment processing fees
- Remain on original account
Payment Models
- Prepaid
- Postpaid
Prepaid Model Requirements:
- Destination account must have sufficient balance
- Fees are deducted immediately
- Transaction fails if insufficient funds
// Check balance before setting fee target
const balance = await getBalance(targetAccountId);
if (balance.available_balance >= expectedFees) {
await changeFeeTarget(sourceAccountId, targetAccountId);
}
Postpaid Model Characteristics:
- No balance requirement
- Fees are consolidated monthly
- Invoiced by WEpayments finance team
- Better for high-volume operations
// Postpaid setup - no balance check needed
await changeFeeTarget(sourceAccountId, targetAccountId, {
fee_wallet: true
});
Best Practices
Same Customer Domain: Ensure both source and target accounts belong to the same customer domain before attempting the transfer.
Fee Wallet Configuration: When using
fee_wallet: true, ensure the destination account is properly configured as a fee wallet.Audit Trail: Keep a log of all fee target changes for accounting and reconciliation purposes.
Was this page helpful?

