Integrate Coinremitter In Laravel
While taking a business on a global level, the payment method plays an important role. While dealing in cryptocurrencies, having a hassle-free payment method is a must. Crypto payment plugins do this for you.
Basically, Laravel is a PHP framework, in which Coinremitter can be integrated to process crypto payments. This plugin will help merchants accept crypto payments without leaving the Laravel website.
Merchants can integrate Laravel crypto payment plugin using Laravel Composer. Most of the integration process contains simple coding. Here is how you can integrate Coinremitter into Laravel:
You can install the Coinremitter plugin using Laravel Composer:
composer require coinremitter/laravel
Add Coinremitter\CoinremiterServiceProvider: class line at the bottom of the provider's array.
'providers' => [
Coinremitter\CoinremiterServiceProvider::class,
]
php artisan vendor:publish --provider="Coinremitter\CoinremiterServiceProvider"
If this file doesn't exist then create and set the configuration like this. How to get Password and API key?
Note: Include specific coins in coinremitter.php that you wish to utilize in your system.
return [
'BTC'=>[
'API_KEY'=>'YOUR_API_KEY_FROM_COINREMITTER_WALLET',
'PASSWORD'=>'YOUR_PASSWORD_FOR_WALLET',
],
'LTC'=>[
'API_KEY'=>'YOUR_API_KEY_FROM_COINREMITTER_WALLET',
'PASSWORD'=>'YOUR_PASSWORD_FOR_WALLET',
],
];
You must include package namespace wherever you prefer to use this library, such as:
use Coinremitter\Coinremitter;
After using the namespace to access all library methods by creating class objects like,
$btc_wallet = new Coinremitter('BTC');
Here "BTC" must be in the config/coinremitter.php file array.
Get the balance of your wallet using a get_balance call.
$balance = $btc_wallet->get_balance();
This will return either a response to success or a response to an error if anything went wrong.
{
"flag":1,
"msg":"Get balance successfully",
"action":"get-balance",
"data":{
"balance":0.2457,
"wallet_name":"my-wallet",
"coin_name":"Bitcoin"
}
}