<aside> ➡️

See the full list of input and return types with detailed explanations in the API Reference

</aside>

Initialisation

// You can get those variables at the B2B section of your partner account
$client = new Client([
    'domain' => "b2b.swapduck.space",
    'partner_id' => "stinky-duck-HbMytL",
    'public_key' => "changeme",
    'private_key' => "changeme",
]);

Testing

// This will call some endpoints on our side
$client->test();

Getting the XML pairs list

<aside> ℹ️

Our XML file is based on the BestChange XML format. Currencies not present on BestChange will have IDs based on their name and network.

</aside>

$xml = $client->getXml('my-personal-xml');
// drop the .xml extension at the end
// ex.: /rates/xml/my-personal-xml.xml -> my-personal-xml

Estimating rate

Listing currencies

$currencies = $client->listCurrencies();

Getting a rate estimation

$out = $client->estimateRate([
    'amount_left' => '1',
    'currency_left_name' => 'BTC',
    'currency_left_network' => 'BTC',
    'currency_right_name' => 'USDT',
    'currency_right_network' => 'TRC20',
]);

Order processing

Creating an order