Skip to main content

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
Client
required
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);
Upload a logo for your client (base64 encoded).
public function UploadLogo(ClientLogoUpload $logoUpload, ?string $idempotencyKey = null): void
logoUpload
ClientLogoUpload
required
Logo upload object with base64 encoded file
idempotencyKey
string
Idempotency key
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
file
string
required
Path to the logo file
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
fundsType
FundsType
Type of wallets to retrieve (FEES, CREDIT, or null for default wallets)
sorting
Sorting
Sorting parameters
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
fundsType
FundsType
required
Type of wallet (FEES or CREDIT)
currencyIso
CurrencyIso
required
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
fundsType
FundsType
Wallet type (FEES, CREDIT, or null for all)
currencyIso
CurrencyIso
Currency filter (required if fundsType is specified)
pagination
Pagination
Pagination parameters
filter
FilterTransactions
Transaction filters
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
bankAccount
BankAccount
required
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
payOut
PayOut
required
PayOut object
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
payIn
PayIn
required
PayIn object
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:
ClientId
string
Your Mangopay client ID
Name
string
Platform name
Email
string
Primary contact email
PrimaryThemeColour
string
Hex color code for primary theme (#RRGGBB)
PrimaryButtonColour
string
Hex color code for primary buttons
URL to your uploaded logo
TechEmails
array
Array of technical contact emails
AdminEmails
array
Array of admin contact emails
FraudEmails
array
Array of fraud notification emails
BillingEmails
array
Array of billing notification emails
PlatformDescription
string
Description of your platform
PlatformURL
string
Your platform website URL
HeadquartersAddress
Address
Platform headquarters address
TaxNumber
string
Platform tax identification number
CompanyReference
string
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";
    }
}

Monitoring Platform Finances

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

Build docs developers (and LLMs) love