لاراپی یک پکیج لاراول برای اتصال به درگاههای پرداختی ایرانی است.
Class | Name (en) | Name (fa) | Requirements |
---|---|---|---|
BehPardakht | Beh Pardakht Mellat | بهپرداخت ملت | terminalId , username , password |
Digipay | Digipay | دیجیپی | username , password , client_id , client_secret |
IdPay | IdPay | آیدیپی | apiKey , sandbox |
IranKish | Iran Kish | ایران کیش | terminalId , password , acceptorId , pubKey |
PardakhtNovin | Pardakht Novin | پرداخت نوین | userId , password , terminalId |
Payir | Pay.ir | پی.آیآر | api |
PayPing | PayPing | پی پینگ | token |
Polam | Polam(Poolam) | پولام | api_key |
Sep | Saman Electronic Payment | پرداخت الکترونیک سامان (سپ) | terminalId |
SepehrPay | Sepehr Pay | پرداخت الکترونیک سپهر (مبنا) | terminalId |
ZarinPal | Zarin Pal | زرین پال | merchant_id |
Zibal | Zibal | زیبال | merchant |
... |
If you don't find the gate you want, let us know or contribute to add it
اگر درگاه مورد نظر خود را پیدا نکردید، به ما اطلاع دهید یا در اضافه کردن آن مشارکت کنید
- Simple | ساده
- Flexibility | انعطافپذیری
- Fee Calculation | محاسبه هزینه تراکنش
You can install the package via composer:
شما میتوانید با استفاده از composer پکیج را نصب کنید
composer require farayaz/larapay
To make the payment, 3 steps must be done:
برای انجام پرداخت ۳ مرحله میبایست انجام شود:
use Farayaz\Larapay\Exceptions\GatewayException;
use Larapay;
$gatewayClass = 'ZarinPal';
$gatewayConfig = [ // gateway config | تنظیمات درگاه
'merchant_id' => 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
];
$amount = 10000;
$id = 1230; // transaction id | شماره تراکنش
$callback = route('api.transactions.verify', $id);
try {
$result = Larapay::gateway($gatewayClass, $gatewayConfig)
->request(
id: $id,
amount: $amount,
callback: $callback
);
} catch (GatewayException $e) {
throw $e;
}
// store token in db | ذخیره توکن در دیتابیس
$result['token'];
$result['fee'];
Transfer the user to gateway with the received token:
انتقال کاربر به درگاه با توکن دریافت شده:
try {
return Larapay::gateway($gatewayClass, $gatewayConfig)
->redirect($id, $token);
} catch (GatewayException $e) {
throw $e;
}
Checking the payment status after the user returns from the gateway:
بررسی وضعیت پرداخت پس از بازگشت کاربر از درگاه:
$params = $request->all();
try {
$result = Larapay::gateway($gatewayClass, $gatewayConfig)
->verify(
id: $id,
amount: $amount,
token: $token,
params: $params
);
} catch (GatewayException $e) {
// transaction failed | تراکنش ناموفق
throw $e;
}
// transaction verified | تراکنش موفق
$result['result'];
$result['reference_id'];
$result['tracking_code'];
$result['card'];
$result['fee'];