通过telr支付网关在线支付
dev-main
2024-08-10 16:51 UTC
This package is not auto-updated.
Last update: 2024-09-22 15:38:49 UTC
README
安装
您可以通过composer安装此包
composer require telr_payment/telr
从Laravel 5.5版本开始,服务提供程序将自动注册。在框架的旧版本中,只需将服务提供程序添加到config/app.php
文件中即可
'providers' => [ // ... TelrPaymentGateway\TelrServiceProvider::class, ];
您可以使用以下提供程序进行发布
php artisan vendor:publish --provider="TelrPaymentGateway\TelrServiceProvider"
之后,您可以通过运行迁移命令创建telr交易表
php artisan migrate
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 \TelrPaymentGateway\TelrManager(); $billingParams = [ 'first_name' => 'Saeed', 'sur_name' => 'Khan', 'address_1' => 'test 123', 'address_2' => 'test 2', 'city' => 'City Name', 'region' => 'State Name', 'zip' => 'Zip Code', 'country' => '2 letter Country Code', 'email' => 'example@company.com', ]; return $telrManager->pay('ORDER_ID_GOES_HERE', 'TOTAL_AMOUNT', 'DESCRIPTION ...', $billingParams)->redirect();
- 注意,如果您想在创建令牌处理支付时避免发送账单参数,这是适用的,并且
将需要它,并且将在 请求中获取客户信息。
在telr回调(成功|取消|拒绝)时处理响应,请放置以下代码
$telrManager = new \TelrPaymentGateway\TelrManager(); $telrManager->handleTransactionResponse($request);