PHP code example of yarcode / yii2-payeer

1. Go to this page and download the library: Download yarcode/yii2-payeer 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/ */

    

yarcode / yii2-payeer example snippets


'payeerApi' => [
    'class' => \yarcode\payeer\Api::class,
    'accountNumber' => '<account number>',
    'apiId' => '<api ID>',
    'apiSecret' => '<your secret>'
],

/** @var \yarcode\payeer\Api $api */
$api = Yii::$app->get('payeerApi');

try {
    $result = $api->balance();    
} catch(ApiException $e) {
    // handle API errors here, for instance:
     $error = $e->getMessage();
     $result = null;
}


$api->isAuth();
$api->balance();
$api->transfer($to, $sum, $curIn, $curOut = null, array $restParams = [])
$api->checkUser('P1234567')
$api->getExchangeRate();
$api->initOutput($psId, $sumIn, $accountNumber, $curIn = self::CURRENCY_USD, $curOut = null);
$api->output($psId, $sumIn, $accountNumber, $curIn = self::CURRENCY_USD, $curOut = null);
$api->getPaySystems();
$api->historyInfo($historyId);
$api->shopOrderInfo($shopId, $orderId);
$api->history(array $params = []);
$api->merchant($shop, $ps, $form, array $restParams = []);


'payeer' => [
    'class' => \yarcode\payeer\Merchant::class,
    'shopId' => '<shop ID>',
    'secret' => '<merchant secret>',
    'currency' => '<default shop currency>' // by default Merchant::CURRENCY_USD
],

<?= \yarcode\payeer\RedirectForm::widget([
    'merchant' => Yii::$app->get('payeer'),
    'invoiceId' => $invoiceId,
    'amount' => $amount,
    'description' => $description,
    'currency' => \yarcode\payeer\Merchant::CURRENCY_USD // By default Merchant component currency
]); 
bash
php composer.phar