PHP code example of b2binpay / api-php

1. Go to this page and download the library: Download b2binpay/api-php 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/ */

    

b2binpay / api-php example snippets


$provider = new B2Binpay\Provider(
    'API_KEY',
    'API_SECRET'
);

$provider = new B2Binpay\Provider(
    'API_KEY',
    'API_SECRET',
    true
);

$bill = $provider->createBill(  
        'WALLET_ID',
        'AMOUNT',
        'CURRENCY',
        'LIFETIME',
        'TRACKING_ID',
        'CALLBACK_URL',
        'SUCCESS_URL',
        'ERROR_URL'
  );

$rates = $provider->getRates('BASE_CURRENCY', 'RATE_TYPE');

$amount = $provider->convertCurrency('AMOUNT', 'BASE_CURRENCY', 'CURRENCY', $rates);

$amount = $provider->addMarkup($amount, 'CURRENCY', 10);

$bill = $provider->createBill(
        'WALLET_ID',
        $amount,
        'CURRENCY',
        'LIFETIME',
        '202009051801',
        'https://my.callback.url/callback.php'
    );

header('HTTP/1.1 200 OK');
exit('OK');

$verifySign = $provider->verifySign($_POST['sign']['time'], $_POST['sign']['hash']);
if (!$verifySign) {
    header('HTTP/1.1 401 Unauthorized');
    exit();
}

$bill = $provider->createWithdrawal(  
        'VIRTUAL_WALLET_ID',
        'AMOUNT',
        'CURRENCY',
        'ADDRESS',
        'UNIQUE_ID',
        'TRACKING_ID',
        'CALLBACK_URL',
        'MESSAGE',
        'WITH_FEE'
    );
shell
composer