paystar3 / laravel-ipg
A package for PayStar payment gateway and those for whom time is important
dev-main
2026-06-12 07:18 UTC
Requires
- php: 7.*|8.*
- laravel/framework: 7.*|8.*|9.*|10.*|11.*|12.*
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-10-21 22:18:08 UTC
README
This is a Laravel package for PayStar payment gateway.
⬇️ Installation guide
Install package
composer require paystar3/laravel-ipg
Publish configs
php artisan vendor:publish --tag=paystar-ipg
📖 List of available methods
create(): return a tokenpayment(): auto redirect to gatewayverify(): verify transaction
✔️ How to use exists methods and options
-
Use
create()methodList of extra option
Option description name customer name phone customer phone mail customer mail description description of order allotment Share per transaction callback_method - wallet_hashid - national_code national code of customer How to use this options
<?php use PayStar\Ipg\Driver\PayStar; use PayStar\Ipg\Facades\Encryption; $paystar = new PayStar(); $res = $paystar->create($amount, $payment->id, route('callback', ['additional|_parameters' => 'additional_parameters']),null, [ 'national_code' => 'National ID', 'card_number' => 'Card Number', 'callback_method' => 1 ]); $result = $res->json(); if ($result['status'] === 1) { $payment->reference_id = $result['data']['ref_num']; $payment->save(); return \redirect("https://api.paystar.shop/api/pardakht/payment?token={$result['data']['token']}"); }
-
Use
verify()method<?php use PayStar\Ipg\Driver\PayStar; use PayStar\Ipg\Facades\Encryption; $paystar = new PayStar(); $sign = Encryption::hash( config('paystar-ipg.encryption_algorithm'), $payment->amount . '#'. $request->input('ref_num') . '#'. $request->input('card_number') . '#'. $request->input('tracking_code'), config('paystar-ipg.encryption_key') ); if (request()->input('status') > 0 && !$last_4_digit_of_users_card_number != substr($request->input('card_number'), -4)) { throw new \Exception(__('Card doesnt belong to the user!')); } $res = $paystar->verify($payment->reference_id, $payment->amount, $sign); $result = $res->json(); if ($result['status'] === 1) { $amount = $result['data']['price']; $trackingCode = $request->input('tracking_code'); } else { throw new \Exception(__('Payment failed!')); }
#️⃣ How to generate sign
<?php use PayStar\Ipg\Facades\Encryption; // The Encryption Facade has 3 methods Encryption::sign($amount, $orderId, $callbackUrl); // Generate a sign with set algorithm in config file Encryption::algos(); // Show list of hash Algorithms (hash_algos() method) Encryption::hash($algo, $string, $key, $binary); // use hash_hmac() method