thebikramlama / hbl
HBL 支付集成 - Laravel 包
v1.0.1
2020-03-15 17:46 UTC
This package is auto-updated.
Last update: 2024-09-17 20:38:05 UTC
README
请注意,此包不再工作。
请查看新集成的演示: 演示
请联系我: contact@bikramlama.com.np 或拨打 9808134818 了解新集成。
喜马拉雅银行支付集成 - Laravel 包
HBL Laravel 包可用于生成喜马拉雅银行支付请求。
入门
此包可以通过 Composer 安装。
composer require thebikramlama/hbl
发布 hbl.php
配置文件进行配置
php artisan vendor:publish --provider="Thebikramlama\Hbl\HblServiceProvider"
配置
编辑 config/hbl.php
中的配置文件
"merchantId" => "987654321", // Merchant ID provided by Himalayan Bank "secretKey" => "abcdef0987654321", // Secrect Key associated with the Merchant ID "currencyCode" => "NPR", // Currency type: USD, NPR "nonSecure" => "Y", // Option for OTP authentication Y/N, Y means disable authentication "methodUrl" => "https://hblpgw.2c2p.com/HBLPGW/Payment/Payment/Payment", // Only update URL if needed "clickContinue" => false, // Click to continue for Payment Page redirection true/false "redirectWait" => 1500, // Redirect wait time in miliseconds, set 0 for no wait time
制作支付请求
安装完成后,默认会生成 Hbl
别名。
使用默认别名
// Using Default Alias use Hbl;
创建支付请求
创建支付请求的语法
Hbl::payment($amount, $identifier, $description, $userDefinedValuesArr, $merchantID, $merchantSecret, $currencyCode, $nonSecure);
字段
$amount
(整数,必需):要支付的金额$identifier
(整数,可选):用于发票的唯一标识符。(可以是订单 ID)$description
(文本,可选):要在支付页面/发票上显示的描述文本。$userDefinedValuesArr
(数组,可选):要发送和接收的定制值作为 postback。(例如:验证数据)$merchantID
(可选):除配置文件外的定制商户,如果您打算使用多个账户进行支付,请使用此参数。$merchantSecret
(可选):使用与定制 merchantID 相关的秘密密钥$currencyCode
(可选):如果您打算使用多种货币支付,请使用此参数。可用选项:"NPR","USD"。$nonSecure
(可选):使用此参数启用/禁用 OTP 认证。可用选项:"Y","N"(Y 表示禁用)
示例
只有金额的示例
$amount = 250; Hbl::payment($amount); // This will create and redirect to the payment page of Rs/$ 250
更多参数的示例
// $booking is a dynamic collection $amount = $booking->amount; $identifier = $booking->id; $description = "Booking Payment."; $userDefinedValues = [ "bookingUser" => $booking->user, "paymentHash" => md5($amount.'MySecretSalt') // To use the hash to verify pament later ]; // Make a payment request Hbl::payment($amount, $identifier, $description, $userDefinedValues);
完整参数的示例
// $booking is a dynamic collection $amount = $booking->amount; $identifier = $booking->id; $description = "Booking Payment."; $userDefinedValues = [ "bookingUser" => $booking->user, "paymentHash" => md5($amount.'MySecretSalt') // To use the hash to verify pament later ]; // Custom Merchant $merchantID = "123456789"; $merchantSecret = "abcdef1234567890"; $currencyCode = "USD"; $nonSecure = "N"; // Make a payment request Hbl::payment($amount, $identifier, $description, $userDefinedValues, $merchantID, $merchantSecret, $currencyCode, $nonSecure); // This code will generate a payment page with custom merchant, Currency in US Dollars and Enable OTP authentication
重要说明
- 路由名称:包生成的
hbl.index
、hbl.error
,请勿覆盖。 - 自定义视图:在
resources/views/vendor/hbl/
下创建自定义视图文件夹,从:vendor/thebikramlama/hbl/src/views/
复制原始视图文件。
致谢
许可证
MIT 许可证(MIT)。有关更多信息,请参阅许可证文件。