1. Go to this page and download the library: Download asciisd/knet 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/ */
asciisd / knet example snippets
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Asciisd\Knet\HasKnet;
class User extends Authenticatable {
use HasKnet;
}
try{
$user = User::find(1);
$payment = $user->pay(10);
$payment->url; // this will return payment link
} catch(\Asciisd\Knet\Exceptions\PaymentActionRequired $exception) {
return redirect($exception->payment->actionUrl());
}
try{
$payment = request()->user()->pay(request()->amount, [
'udf1' => request()->user()->name,
'udf2' => request()->user()->email
]);
} catch(\Asciisd\Knet\Exceptions\PaymentActionRequired $exception) {
// do whatever you want with this
$payment = $exception->payment;
} finally {
// redirect user to payment url to complete the payment
return $payment->actionUrl();
}
bash
php artisan knet:install
bash
php artisan knet:publish
bash
php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.