Lazerpay Laravel Package
pipedev/lazerpay is a laravel sdk package that access to laravel api
Installation
PHP 5.4+ and Composer are required.
To get the latest version of Laravel Lazerpay, simply require it
composer require pipedev/lazerpay
Or add the following line to the require block of your composer.json
file.
"pipedev/lazerpay": "*"
You'll then need to run composer install
or composer update
to download it and have the autoloader updated.
Once Laravel Lazerpay is installed, you need to register the service provider. Open up config/app.php
and add the following to the providers
key.
'providers' => [
...
Pipedev\Lazerpay\LazerPayServiceProvider::class,
...
]
If you use Laravel >= 5.5 you can skip this step and go to
configuration
Pipedev\Lazerpay\LazerPayServiceProvider::class
Also, register the Facade like so:
'aliases' => [
...
'Lazerpay' => Pipedev\Lazerpay\Facades\LazerpayFacade::class,
...
]
Configuration
You can publish the configuration file using this command:
php artisan vendor:publish --provider="Pipedev\Lazerpay\LazerPayServiceProvider" --tag="lazerpay"
A configuration-file named lazerpay.php
with some sensible defaults will be placed in your config
directory:
<?php
return [
/**
* Public Key From Lazerpay developer Dashboard
*
*/
'lazer_public_key' => env('LAZER_PUBLIC_KEY'),
/**
* Secret Key From Lazerpay developer Dashboard
*
*/
'lazer_secret_key' => env('LAZER_SECRET_KEY')
];
Usage
Open your .env file and add your lazer pay public key and secret key as displayed below:
LAZER_PUBLIC_KEY=********
LAZER_SECRET_KEY=*******
Test
composer test
Basic methods this package provides....
<?php
use Pipedev\Lazerpay\Lazerpay;
$lazerpay = new Lazerpay();
/**
* Initializes a payment transaction and returns the address to be used in completing the payment.
*/
$lazerpay->initializePayment([
"customer_name" => "iamnotstatic.eth",
"customer_email" => "[email protected]",
"coin" => "USDC",
"currency" => "USD",
"amount" => 100,
"fiatAmount" => "100",
"accept_partial_payment" => true
]);
/**
* Gets the list of coins supported by Lazerpay.
* Using a mainnet API key returns accepted coins on the mainnet and using a testnet API key returns the accepted coins on the testnet.
*/
$lazerpay->getAcceptedCoins();
/**
* Checks if a payment has been completed and returns a state to show the status of the payment.
* Payment status can either be confirmed or incomplete.
*/
$identifier = 'Transaction reference';
$lazerpay->confirmPayment($identifier);
/**
* Transfers crypto amount from businesses lazerpay balance to external crypto wallet
*/
$lazerpay->transferFunds([
"amount" => 1,
"recipient" => "0x0B4d358D349809037003F96A3593ff9015E89efA",
"coin" => 'BUSD',
"blockchain" => 'Binance Smart Chain',
]);
Todo
- Webhooks
Contributing
Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.
π
π
Support me Kindly star the repo and share with friends
Don't forget to follow me on twitter!