PHP code example of parsecvpn / heleket-laravel-integrate
1. Go to this page and download the library: Download parsecvpn/heleket-laravel-integrate 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/ */
parsecvpn / heleket-laravel-integrate example snippets
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
// Other kernel properties...
/**
* The application's route middleware groups.
*
* @var array
*/
protected $routeMiddleware = [
// Other middlewares...
'heleket' => 'App\Http\Middleware\HeleketMiddleware',
];
}
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HeleketController;
// Other routes properties...
Route::group(['middleware' => ['heleket']], function () {
Route::post('/heleket/webhook', [HeleketController::class, 'webhook']);
});
}
php
namespace App\Console\Commands;
use Parsecvpn\Heleket\HeleketSdk;
use Illuminate\Console\Command;
class HeleketTestCommand extends Command
{
protected $signature = 'heleket:test';
protected $description = 'Test Heleket SDK';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$instance = new HeleketSdk();
echo $instance->create_payment(
'INV-test-01',
100,
'USDT',
'BSC',
'INV-test-01',
'https://yourdomain.ltd/invoices/INV-test-01',
'https://yourdomain.ltd/invoices/INV-test-01',
'https://yourdomain.ltd/invoices/INV-test-01?success=true' // Remember that param success=true or any similar is just for toast notification, do not put any logical process here
);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.