CoinPayment is a Laravel module for handling transactions from CoinPayment like a create transaction, history transaction, etc.
| version | laravel |
|---|---|
| v1.1.3 | 5.6 |
| v2.0.0 | ^5.8 |
- Laravel ^5.8
- PHP >= ^7.2
You can install this package via composer:
$ composer require hexters/coinpayment
Publishing vendor
$ php artisan vendor:publish --tag=coinpayment
Install CoinPayment configuration
$ php artisan coinpayment:install
Installation finish.
Create Button transaction. Example placed on your controller
. . .
/*
* @required true
*/
$transaction['amountTotal'] = 30;
$transaction['note'] = 'Note for your transaction';
$transaction['buyer_email'] = 'buyer@mailinator.com';
$transaction['redirect_url'] = url('/back_to_tarnsaction');
/*
* @required true
* @example first item
*/
$transaction['items'][] = [
'itemDescription' => 'Product one',
'itemPrice' => 10, // USD
'itemQty' => 1,
'itemSubtotalAmount' => 10 // USD
];
/*
* @example second item
*/
$transaction['items'][] = [
'itemDescription' => 'Product two',
'itemPrice' => 10, // USD
'itemQty' => 1,
'itemSubtotalAmount' => 10 // USD
];
/*
* @example third item
*/
$transaction['items'][] = [
'itemDescription' => 'Product Three',
'itemPrice' => 10, // USD
'itemQty' => 1,
'itemSubtotalAmount' => 10 // USD
];
$transaction['payload'] = [
'foo' => [
'bar' => 'baz'
]
];
return \CoinPayment::generatelink($transaction);
. . .
Open the Job file App\Jobs\CoinpaymentListener for the listen the our transaction and proccess
This function will execute orders without having to wait for the process from IPN
We can also make cron to run this function if we don't use IPN
/**
* this is triger function for running Job proccess
*/
return \CoinPayment::getstatusbytxnid("CPDA4VUGSBHYLXXXXXXXXXXXXXXX");
/**
output example: "celled / Timed Out"
*/
\CoinPayment::gettransactions()->where('status', 0)->get();
Except this path /coinpayment/ipn into csrf proccess in App\Http\Middleware\VerifyCsrfToken
. . .
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'/coinpayment/ipn'
];
. . .
Gift me a coffee ☕☕☕☕
BTC: 1388MHjeHmq6kUC7WpSS6pPtgG7hm7fCau
