Overview
The ApiClients class provides methods for managing your Mangopay client account information, including platform details, client wallets (fees and credit), and platform-level operations.
Methods
Get
Retrieve your client information.
public function Get(): Client
Returns: Client object with your platform details
Example:
$client = $api->Clients->Get();
echo "Client ID: " . $client->ClientId . "\n";
echo "Name: " . $client->Name . "\n";
echo "Email: " . $client->Email . "\n";
echo "Primary theme color: " . $client->PrimaryThemeColour . "\n";
Update
Update your client information.
public function Update(Client $client): Client
Client object with updated properties
Returns: Updated Client object
Example:
$client = $api->Clients->Get();
$client->PrimaryThemeColour = '#FF0000';
$client->PrimaryButtonColour = '#00FF00';
$client->TechEmails = ['[email protected]', '[email protected]'];
$updatedClient = $api->Clients->Update($client);
UploadLogo
Upload a logo for your client (base64 encoded).
public function UploadLogo(ClientLogoUpload $logoUpload, ?string $idempotencyKey = null): void
Logo upload object with base64 encoded file
Example:
$logo = new MangoPay\ClientLogoUpload();
$logo->File = base64_encode(file_get_contents('/path/to/logo.png'));
$api->Clients->UploadLogo($logo);
echo "Logo uploaded successfully\n";
UploadLogoFromFile
Upload a logo directly from a file path.
public function UploadLogoFromFile(string $file, ?string $idempotencyKey = null): void
Example:
$api->Clients->UploadLogoFromFile('/path/to/logo.png');
Supported formats: GIF, PNG, JPG, JPEG, BMP, PDF, DOC. Maximum file size: ~7MB.
GetWallets
Retrieve your client wallets (fees, credit, or default wallets).
public function GetWallets(?FundsType $fundsType = null, ?Sorting $sorting = null): array
Type of wallets to retrieve (FEES, CREDIT, or null for default wallets)
Returns: Array of Wallet objects
Example:
// Get fees wallets
$feesWallets = $api->Clients->GetWallets(MangoPay\FundsType::FEES);
foreach ($feesWallets as $wallet) {
echo "Fees wallet {$wallet->Currency}: " .
($wallet->Balance->Amount / 100) . " {$wallet->Currency}\n";
}
// Get credit wallets
$creditWallets = $api->Clients->GetWallets(MangoPay\FundsType::CREDIT);
foreach ($creditWallets as $wallet) {
echo "Credit wallet {$wallet->Currency}: " .
($wallet->Balance->Amount / 100) . " {$wallet->Currency}\n";
}
GetWallet
Retrieve a specific client wallet by type and currency.
public function GetWallet(FundsType $fundsType, CurrencyIso $currencyIso): Wallet
Type of wallet (FEES or CREDIT)
Currency code (EUR, USD, GBP, etc.)
Returns: Wallet object
Example:
$feesWalletEUR = $api->Clients->GetWallet(
MangoPay\FundsType::FEES,
MangoPay\CurrencyIso::EUR
);
echo "EUR fees balance: €" . ($feesWalletEUR->Balance->Amount / 100) . "\n";
GetWalletTransactions
Retrieve transactions for client wallets.
public function GetWalletTransactions(?FundsType $fundsType = null, ?CurrencyIso $currencyIso = null, ?Pagination &$pagination = null, ?FilterTransactions $filter = null): array
Wallet type (FEES, CREDIT, or null for all)
Currency filter (required if fundsType is specified)
Returns: Array of Transaction objects
Example:
// Get all fees wallet transactions for EUR
$pagination = new MangoPay\Pagination(1, 50);
$transactions = $api->Clients->GetWalletTransactions(
MangoPay\FundsType::FEES,
MangoPay\CurrencyIso::EUR,
$pagination
);
foreach ($transactions as $tx) {
echo "Transaction {$tx->Id}: {$tx->Type} - €" .
($tx->CreditedFunds->Amount / 100) . "\n";
}
CreateBankAccount
Create a bank account for client payouts.
public function CreateBankAccount(BankAccount $bankAccount, ?string $idempotencyKey = null): BankAccount
Bank account object (IBAN type)
Returns: Created BankAccount object
CreatePayOut
Create a payout from client wallet.
public function CreatePayOut(PayOut $payOut, ?string $idempotencyKey = null): PayOut
Returns: Created PayOut object
CreateBankWireDirectPayIn
Create a direct bank wire PayIn to settle a negative repudiation wallet balance.
public function CreateBankWireDirectPayIn(PayIn $payIn, ?string $idempotencyKey = null): PayIn
Returns: Created PayIn object
This method allows platforms to make a direct bank wire PayIn to their repudiation wallet to settle negative balances from lost disputes.
Client Entity
The Client object contains:
Hex color code for primary theme (#RRGGBB)
Hex color code for primary buttons
URL to your uploaded logo
Array of technical contact emails
Array of admin contact emails
Array of fraud notification emails
Array of billing notification emails
Description of your platform
Your platform website URL
Platform headquarters address
Platform tax identification number
Company registration number
Complete Client Management Example
// Get client information
$client = $api->Clients->Get();
echo "Platform: {$client->Name}\n";
echo "Client ID: {$client->ClientId}\n";
// Update branding
$client->PrimaryThemeColour = '#824010';
$client->PrimaryButtonColour = '#F58220';
$client->TechEmails = ['[email protected]', '[email protected]'];
$client->FraudEmails = ['[email protected]'];
$updatedClient = $api->Clients->Update($client);
// Upload logo
$api->Clients->UploadLogoFromFile('/path/to/platform-logo.png');
// Check fees collected
$feesWallets = $api->Clients->GetWallets(MangoPay\FundsType::FEES);
foreach ($feesWallets as $wallet) {
$balance = $wallet->Balance->Amount / 100;
echo "Collected fees in {$wallet->Currency}: {$balance}\n";
// Get recent fees transactions
$pagination = new MangoPay\Pagination(1, 10);
$transactions = $api->Clients->GetWalletTransactions(
MangoPay\FundsType::FEES,
$wallet->Currency,
$pagination
);
echo "Recent fees transactions:\n";
foreach ($transactions as $tx) {
$amount = $tx->CreditedFunds->Amount / 100;
echo " {$tx->CreationDate}: +{$amount} {$wallet->Currency}\n";
}
}
class PlatformFinanceDashboard {
private $api;
public function __construct($api) {
$this->api = $api;
}
public function getFeesBreakdown() {
$feesWallets = $this->api->Clients->GetWallets(MangoPay\FundsType::FEES);
$breakdown = [];
foreach ($feesWallets as $wallet) {
$currency = $wallet->Currency;
$balance = $wallet->Balance->Amount / 100;
// Get monthly fees
$filter = new MangoPay\FilterTransactions();
$filter->AfterDate = strtotime('first day of this month');
$transactions = $this->api->Clients->GetWalletTransactions(
MangoPay\FundsType::FEES,
$currency,
null,
$filter
);
$monthlyFees = array_reduce($transactions, function($sum, $tx) {
return $sum + $tx->CreditedFunds->Amount;
}, 0) / 100;
$breakdown[$currency] = [
'balance' => $balance,
'monthly_fees' => $monthlyFees,
'transaction_count' => count($transactions)
];
}
return $breakdown;
}
public function getCreditBalances() {
$creditWallets = $this->api->Clients->GetWallets(MangoPay\FundsType::CREDIT);
$balances = [];
foreach ($creditWallets as $wallet) {
$balances[$wallet->Currency] = $wallet->Balance->Amount / 100;
}
return $balances;
}
}
$dashboard = new PlatformFinanceDashboard($api);
echo "Fees Breakdown:\n";
print_r($dashboard->getFeesBreakdown());
echo "\nCredit Balances:\n";
print_r($dashboard->getCreditBalances());
Client Wallets:
- Fees Wallets: Accumulate fees charged on transactions
- Credit Wallets: Hold credits provided by Mangopay or for specific purposes
- These are separate from user wallets and managed at the platform level
See Also