mniknab/lara-gateway

一个用于连接所有伊朗支付网关的Laravel包(由larabook/gateway分支而来

3.2.10 2022-10-10 13:29 UTC

This package is auto-updated.

Last update: 2024-09-10 18:08:34 UTC


README

包的主页: larabook.ir

使用此包,我们能够通过一个独特的API连接到所有伊朗银行。

一旦您遇到错误问题,请通知我们。

可用银行

  1. MELLAT
  2. SADAD (MELLI)
  3. SAMAN
  4. PARSIAN
  5. PASARGAD
  6. ZARINPAL
  7. JAHANPAY
  8. PAYLINE

安装:

在您的终端运行以下语句

步骤 1

composer require larabook/gateway

步骤 2:在config/app.php中添加provider和facade

'providers' => [
  ...
  Larabookir\Gateway\GatewayServiceProvider::class, // <-- add this line at the end of provider array
],


'aliases' => [
  ...
  'Gateway' => Larabookir\Gateway\Gateway::class, // <-- add this line at the end of aliases array
]

步骤 3

php artisan vendor:publish --provider=Larabookir\Gateway\GatewayServiceProvider

步骤 4

php artisan migrate

配置文件位于config/gateway.php中,打开它并输入您的银行凭证

您可以通过多种方式(外观、服务容器)与银行建立连接

try {
   
   $gateway = \Gateway::make(new \Mellat());
   // $gateway->setCallback(url('/path/to/calback/route')); You can also change the callback
   $gateway->price(1000)->ready();
   $refId =  $gateway->refId();
   $transID = $gateway->transactionId();

   // Your code here

   return $gateway->redirect();
   
} catch (Exception $e) {
   
   	echo $e->getMessage();
}

您可以通过以下方式调用网关

  1. Gateway::make(new Mellat());
  2. Gateway::mellat()
  3. app('gateway')->make(new Mellat());
  4. app('gateway')->mellat();

除了MELLAT外,您还可以输入我们上面介绍的其他银行名称。

price方法中,您应该输入以IRR(里亚尔)为单位的金额

并在您的回调

try { 
   
   $gateway = \Gateway::verify();
   $trackingCode = $gateway->trackingCode();
   $refId = $gateway->refId();
   $cardNumber = $gateway->cardNumber();
   
   // Your code here
   
} catch (Exception $e) {
   
   echo $e->getMessage();
}  

如果您有兴趣开发此包,您可以通过以下方式帮助我们

  1. 改进文档。
  2. 报告问题或错误。
  3. 在编写代码和其他银行模块方面进行合作。

此包扩展自PoolPort,但我们已更改了一些功能并进行了改进。