PHP code example of fintreen / php-client

1. Go to this page and download the library: Download fintreen/php-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fintreen / php-client example snippets




intreen\FintreenClient;

// or you can download and use 
//  true;


$fintreenClient = new FintreenClient($token, $email, $isTestMode, true);
$currencies = $fintreenClient->getCurrenciesList();

var_dump($currencies);

$orderStatusList = $fintreenClient->getOrderStatusList();

var_dump($orderStatusList);

// Calculate 25 eur in USDT and BTC
$currencyCodesToCalculate = ['USDT-TRC20', 'USDT-ERC20', 'BTC'];
$calculation = $fintreenClient->calculate(25, $currencyCodesToCalculate);

var_dump($calculation);

// Create order for 26 eur in usdt-trc20
$transactionCreated = $fintreenClient->createTransaction(26, 'USDT-TRC20', FintreenClient::DEFAULT_FIAT_CODE);

var_dump($transactionCreated);

$checkedTransaction = $fintreenClient->checkTransaction((int)$transactionCreated['data']['id']);

var_dump($checkedTransaction);

// Filter params for transactions list
$filters = [];
$filters['statusId'] = 1; // New
$filters['isTest'] = (int)$isTestMode; // should be same or will return 404
$filters['perPage'] = 5; // items per page
$filters['page'] = 1;
$filters['codesFilter'] = implode(',', $currencyCodesToCalculate);// comma seprated codes to filter transaction with
// Note that you can use it without filters

$transactionsList = $fintreenClient->getTransactionsList($filters);

// You can alternatively use $fintreenClient->sendRequest
$anotherFilters['statusId'] = 1; // New
$notFilteredTransactions = $fintreenClient->sendRequest('transactions', 'GET', $anotherFilters);
var_dump(@json_decode($notFilteredTransactions, true));


composer req fintreen/php-client