PHP code example of aliwebto / easy-payment
1. Go to this page and download the library: Download aliwebto/easy-payment 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/ */
aliwebto / easy-payment example snippets
// payable model - use Payable trait in your payable model Ex: invoice.
use \Aliwebto\EasyPayment\Payable;
// you have to make a payable model like invoice and relate it to users . then create invoice and pass to easy payment
// create transaction and get data
use Aliwebto\EasyPayment\EasyPayment
$payable = \App\Models\Invoice::find(1);
$amount = $payable->price;
$description = "description of payment";
$easyPayments = EasyPayment::pay($payable,$amount,$description);
return redirect($easyPayments["pay_url"]);
// check transaction is paid
use Aliwebto\EasyPayment\EasyPayment
$payable = \App\Models\Product::find(1);
$payable->isPaid(); // bool
bash
composer vendor:publish --provider="Aliwebto\EasyPayment\EasyPaymentServiceProvider"
php artisan migrat
// set your configs to config/easy-payment.php