laravel_payment / telr
通过telr支付网关在线支付
1.2.1
2020-09-09 15:41 UTC
README
安装
您可以通过composer安装此包
composer require laravel_payment/telr
在Laravel 5.5及更高版本中,服务提供程序将自动注册。在框架的旧版本中,只需将服务提供程序添加到config/app.php
文件中即可
'providers' => [ // ... TelrGateway\TelrServiceProvider::class, ];
您可以使用以下提供程序进行发布
php artisan vendor:publish --provider="TelrGateway\TelrServiceProvider"
之后,您可以通过运行迁移命令来创建telr交易表
php artisan migrate
发布后,配置文件config/telr.php
包含以下内容
return [ // The current mode is live|production or test 'test_mode' => env('TELR_TEST_MODE', true), // The currency of store 'currency' => 'SAR', // The sale endpoint that receive the params // @see https://telr.com/support/knowledge-base/hosted-payment-page-integration-guide 'sale' => [ 'endpoint' => 'https://secure.telr.com/gateway/order.json', ], // The hosted payment page use the following params as it explained in the integration guide // @see https://telr.com/support/knowledge-base/hosted-payment-page-integration-guide/#request-method-and-format 'create' => [ 'ivp_method' => "create", 'ivp_store' => env('TELR_STORE_ID', null), 'ivp_authkey' => env('TELR_STORE_AUTH_KEY', null), 'return_auth' => '/handle-payment/success', 'return_can' => '/handle-payment/cancel', 'return_decl' => '/handle-payment/declined', ] ];
使用方法
在创建路由后,将以下代码放置在重定向到银行页面的位置
$telrManager = new \TelrGateway\TelrManager(); $billingParams = [ 'first_name' => 'Moustafa Gouda', 'sur_name' => 'Bafi', 'address_1' => 'Gnaklis', 'address_2' => 'Gnaklis 2', 'city' => 'Alexandria', 'region' => 'San Stefano', 'zip' => '11231', 'country' => 'EG', 'email' => 'example@company.com', ]; return $telrManager->pay('ORDER_ID_GOES_HERE', 'TOTAL_AMOUNT', 'DESCRIPTION ...', $billingParams)->redirect();
- 注意,如果您想避免在创建处理支付的令牌时发送账单参数,则适用此操作,并且
Telr托管支付页面
将需要它,并在check
请求中获取客户信息。
在telr回调(成功|取消|拒绝)中处理响应,请放置以下代码
$telrManager = new \TelrGateway\TelrManager(); $telrManager->handleTransactionResponse($request);