PHP code example of coinremitterphp / coinremitter-php
1. Go to this page and download the library: Download coinremitterphp/coinremitter-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/ */
coinremitterphp / coinremitter-php example snippets
use CoinRemitter\CoinRemitter;
$wallet = new CoinRemitter('WALLET_API_KEY','WALLET_PASSWORD');
$balance = $wallet->getBalance();
{
"success": true,
"data": {
"wallet_id": "6746c765xxxxxxxxxxxxxx",
"wallet_name": "BTC-wallet",
"coin_symbol": "BTC",
"coin": "Bitcoin",
"coin_logo": "https://api.coinremitter.com/assets/images/coins/32x32/BTC.png",
"blockchain_network_name": "Bitcoin Main Net",
"contract_address": "",
"contract_address_url": "",
"explorer_url": "https://www.blockchain.com/explorer/transactions/btc/",
"chain_id": "1",
"remaining_withdraw_limit_24h": "49",
"balance": "84.73000000",
"minimum_deposit_amount": "0.1"
}
}
$param = [
'label'=>'BTC1'
];
$address = $wallet->createAddress($param);
{
"success": true,
"data": {
"wallet_id": "6746c765xxxxxxxxxxxxxx",
"wallet_name": "BTC-wallet",
"coin": "Bitcoin",
"coin_symbol": "BTC",
"coin_logo": "https://api.coinremitter.com/assets/images/coins/32x32/BTC.png",
"blockchain_network_name": "Bitcoin Main Net",
"contract_address": "",
"contract_address_url": "",
"chain_id": "1",
"address": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"explorer_url": "https://www.blockchain.com/explorer/addresses/btc/xxxxxxxxxxxxxxxxxxxxxxxxxxxx?from=coinremitter",
"label": "BTC1",
"qr_code": "https://qr_code.com/qr?margin=1&size=200&text=xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"minimum_deposit_amount": "1",
"remaining_address_limit": 499,
"wrn_msg": "",
"expire_on": "2025-06-21 09:34:07",
"expire_on_timestamp": 1750498447000
}
}
$param = [
'address'=>'MLjDMFsobgkxxxxxxxxxxxxxxxxxxxx'
];
$validate = $wallet->validateAddress($param);
{
"success": true,
"data": {
"valid": true
}
}
$param = [
'address'=>'MLjDMFsobgkxxxxxxxxxxxxxxxxxxxx', // to send amount.
'withdrawal_speed'=>'priority' // optional,The speed of withdrawal. Either 'priority', 'medium' or 'low'.Default speed take from your wallet settings.
];
$withdraw = $wallet->estimateWithdraw($param);
{
"success": true,
"data": {
"amount": "1.00000000",
"transaction_fee": "0.10000000",
"processing_fee": "0.01000000",
"total_amount": "1.11000000",
"fees_structure": {
"transaction_fee": "0.01",
"processing_fee": "0.23%"
}
}
}
$param = [
'address'=>'MLjDMFsobgkxxxxxxxxxxxxxxxxxxxx', // to send.
'withdrawal_speed' => 'priority' // optional, The speed of withdrawal. Either 'priority', 'medium' or 'low'.Default speed take from your wallet settings.
];
$withdraw = $wallet->withdraw($param);
{
"success": true,
"data": {
"id": "674edd35765xxxxxxxxxxxxxx",
"txid": "1796b1185xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"explorer_url": "https://www.blockchain.com/explorer/transactions/btc/1796b1185xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"amount": "1.00000000",
"transaction_fees": "0.10000000",
"processing_fees": "0.01000000",
"total_amount": "1.11000000",
"to_address": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"wallet_id": "6746c765xxxxxxxxxxxxxx",
"wallet_name": "BTC-wallet",
"coin_symbol": "BTC",
"coin": "Bitcoin",
"date": "2024-12-03 10:28:05",
"transaction_timestamp": 1733221685000,
"remaining_withdraw_limit_24h": "49"
}
}
$param = [
'id'=>'674edd35765xxxxxxxxxxxxxx' //
{
"success": true,
"data": {
"id": "674edd35765xxxxxxxxxxxxxx",
"txid": "1796b1185xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"confirmations": 5,
"om=coinremitter",
"type": "receive",
"coin": "Bitcoin",
"coin_symbol": "BTC",
"wallet_id": "6746c765xxxxxxxxxxxxxx",
"wallet_name": "BTC-wallet",
"address": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"label": "BTC1",
"amount": "1.00000000",
"date": "2024-12-02 09:18:55",
"transaction_timestamp": 1733131135000
}
}
{
"success": true,
"data": {
"id": "674edd35765xxxxxxxxxxxxxx",
"txid": "1796b1185xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"confirmations": 5,
"om=coinremitter",
"type": "send",
"coin": "Bitcoin",
"coin_symbol": "BTC",
"wallet_id": "6746c765xxxxxxxxxxxxxx",
"wallet_name": "BTC-wallet",
"address": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"label": "BTC1",
"amount": "1.00000000",
"date": "2024-12-02 09:18:55",
"transaction_timestamp": 1733131135000
}
}
$param = [
'address' => 'MLjDMFsobgkxxxxxxxxxxxxxxxxxxxx',
];
$response = $wallet->getTransactionByAddress($param);
{
"success": true,
"data": {
"coin": "Bitcoin",
"coin_symbol": "BTC",
"wallet_name": "BTC-wallet",
"wallet_id": "6746c765xxxxxxxxxxxxxx",
"address": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"expire_on": "2025-05-26 07:16:53",
"expire_on_timestamp": 1748243813000,
"label": "BTC1",
"
"explorer_url": "https://www.blockchain.com/explorer/transactions/btc/1796b1185xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"type": "receive",
"amount": "2.00000000",
"date": "2024-11-29 11:15:20",
"transaction_timestamp": 1732878920000,
"confirm_amount": "2.00000000",
"pending_amount": "0.00000000"
}
]
}
}
$param = [
'amount'=>"10.6293", //will display on invoice.
'email'=>'USER_EMAIL', //optional,Send invoice mail on this email.
'fiat_currency'=>'USD', //optional,Fiat currency code. E.g. USD, INR, EUR etc.
'expiry_time_in_minutes'=>'20', //optional, Invoice expiry time in minutes. Default 1440 minutes.
'notify_url'=>'https://yourdomain.com/notify-url', //optional,User will be redirected to this url once payment done.
'success_url' => 'https://yourdomain.com/success-url', //optional,User will be redirected to this url when user cancel payment.,
'fail_url' => 'https://yourdomain.com/fail-url', //optional,url on which user will be redirect if user cancel invoice,
'description'=>'',//optional.The description for the invoice.
'custom_data1'=>'',//optional.This data will be
{
"success": true,
"data": {
"id": "674edd35765xxxxxxxxxxxxxx",
"invoice_id": "0wBv07n",
"url": "https://coinremitter.com/invoice/view/674edd35765xxxxxxxxxxxxxx",
"total_amount": {
"BTC": "0.03000000",
"USD": "10.6293"
},
"paid_amount": {
"BTC": "0.01000000",
"USD": "3.5431"
},
"usd_amount": "10.63",
"amount": "0.03000000",
"conversion_rate": {
"USD_BTC": "0.00282239",
"BTC_USD": "354.31000000"
},
"fiat_currency": "",
"coin": "Bitcoin",
"coin_symbol": "BTC",
"name": "BTC-wallet",
"description": "",
"wallet_name": "BTC-wallet",
"wallet_id": "673d6a3fdfxxxxxxxxxxxxxx",
"merchant_id": "6746c765xxxxxxxxxxxxxx",
"status": "Pending",
"status_code": 0,
"success_url": "",
"fail_url": "",
"notify_url": "",
"expire_on": "",
"expire_on_timestamp": "",
"invoice_date": "2024-12-03 10:41:13",
"custom_data1": "",
"custom_data2": "",
"invoice_timestamp": 1733222473000,
"delete_after": "2025-06-01 10:41:13",
"delete_after_timestamp": 1748774473000
}
}
$param = [
'invoice_id'=>'FJkJEOx' // ;
{
"success": true,
"data": {
"id": "674edd35765xxxxxxxxxxxxxx",
"invoice_id": "FJkJEOx",
"url": "https://coinremitter.com/invoice/view/674edd35765xxxxxxxxxxxxxx",
"total_amount": {
"BTC": "0.03000000",
"USD": "10.6293"
},
"paid_amount": {
"BTC": "0.01000000",
"USD": "3.5431"
},
"usd_amount": "10.63",
"amount": "0.03000000",
"conversion_rate": {
"USD_BTC": "0.00282239",
"BTC_USD": "354.31000000"
},
"fiat_currency": "",
"coin": "Bitcoin",
"coin_symbol": "BTC",
"name": "BTC-wallet",
"description": "",
"wallet_name": "BTC-wallet",
"wallet_id": "673d6a3fdfxxxxxxxxxxxxxx",
"merchant_id": "6746c765xxxxxxxxxxxxxx",
"payment_history": [
{
"txid": "1796b1185xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"explorer_url": "https://www.blockchain.com/explorer/transactions/btc/1796b1185xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?from=coinremitter",
"amount": "0.01000000",
"date": "2024-11-20 05:34:41",
"confirmation": 5,
"
$param = [
'fiat'=>'USD' // ired, Fiat Amount.
'crypto'=>'BTC' // optional, Crypto Symbol.
];
$rate = $wallet->fiatToCryptoRate($param);
{
"success": true,
"data": [
{
"short_name": "ETH",
"name": "Ethereum",
"price": "0.01826164"
},
{
"short_name": "BTC",
"name": "Bitcoin",
"price": "0.00078409"
},
{
"short_name": "USDTERC20",
"name": "Tether USD ERC20",
"price": "50.00000000"
}
]
}
$param = [
'crypto'=>'BTC' // optional, Crypto Symbol.
'crypto_amount'=>'50' //
{
"success": true,
"data": [
{
"code": "USD",
"currency": "United States Dollar",
"amount": "166.84"
},
{
"code": "EUR",
"currency": "Euro",
"amount": "154.16"
},
{
"code": "NZD",
"currency": "New Zealand Dollar",
"amount": "273.62"
},
{
"code": "SGD",
"currency": "Singapore Dollar",
"amount": "225.23"
}
]
}
$supportedCurrency = $btc->getSupportedCurrency();
bash
composer