mubarakismail / telr_payment
该包的最新版本(dev-master)没有提供许可信息。
telr的支付包
dev-master
2023-01-18 12:39 UTC
This package is not auto-updated.
Last update: 2024-09-25 20:37:45 UTC
README
安装
您可以通过composer安装此包
composer require mubarakismail/telr_payment
从Laravel 5.5版本开始,服务提供者将自动注册。在框架的旧版本中,只需在config/app.php
文件中添加服务提供者即可
'providers' => [ // ... Mubarakismail\TelrPayment\TelrServiceProvider::class, ];
您可以使用以下提供者进行发布
php artisan vendor:publish --provider="Mubarakismail\TelrPayment\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 \Mubarakismail\TelrPayment\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托管支付页面
将需要它,并在检查请求中获取客户信息。
在telr回调(成功|取消|拒绝)中处理响应时,请放置以下代码
$telrManager = new \Mubarakismail\TelrPayment\TelrManager(); $telrManager->handleTransactionResponse($request);