1. Go to this page and download the library: Download bitcoinvn/bitcoinvn-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/ */
bitcoinvn / bitcoinvn-php example snippets
$bitcoinVn = new \BitcoinVN\BitcoinVN('YOUR_API_KEY');
$info = $bitcoinVn->info();
$bitcoinVn = new \BitcoinVN\BitcoinVN('YOUR_API_KEY');
$balances = $bitcoinVn->balances();
foreach ($balances as $asset => $balance) {
echo "My {$asset} balance: {$balance}\n";
}
#### Buy 0.1 BTC
$bitcoinVn = new \BitcoinVN\BitcoinVN('YOUR_API_KEY');
$quote = $bitcoinVn->quote('vnd', 'btc', 1_000_000);
$order = $bitcoinVn->fixedSwap($quote->getId(), '12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX');
echo "Send 1,000,000 VND in order to receive {$order->getSettleAmount()} BTC.";
$bitcoinVn = new \BitcoinVN\BitcoinVN('YOUR_API_KEY');
$order = $bitcoinVn->variableSwap('btc', 'vnd', [
'bank' => 'vietcombank',
'accountNumber' => '0123456789',
'accountHolder' => 'Satoshi Nakamoto'
]);
echo "Send any amount of BTC to {$order->getSettleData()['address']} in order to receive VND.";
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.