HBL Payment Integration - Laravel Package

Fund package maintenance!
TheBikramLama

Installs: 129

Dependents: 0

Suggesters: 0

Security: 0

Stars: 10

Watchers: 2

Forks: 4

Open Issues: 0

Language:Blade

Type:package

v1.0.1 2020-03-15 17:46 UTC

This package is auto-updated.

Last update: 2024-05-17 20:04:22 UTC


README

Please note this package is no longer working.
Please check the demo for new integration: Demo
Please contact me at: contact@bikramlama.com.np or call me at 9808134818 for new integration.









Himalayan Bank Payment Integration - Laravel Package

Latest Version Issues Downloads

HBL Laravel Package can be used to generate himalayan bank payment requests.

Getting Started

This package can be installed through Composer.

composer require thebikramlama/hbl

Publish hbl.php config file for configuration

php artisan vendor:publish --provider="Thebikramlama\Hbl\HblServiceProvider"

Configuration

Edit the configuration file in 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

Making a Payment Request

After the installation is complete, Hbl alias is generated by default.

Using the default Alias

// Using Default Alias
use Hbl;

Creating a payment request

Syntax for creating a payment request

Hbl::payment($amount, $identifier, $description, $userDefinedValuesArr, $merchantID, $merchantSecret, $currencyCode, $nonSecure);

Fields

  • $amount (integer, required): Amount to be paid
  • $identifier (integer, optional): Unique identifier used for invoicing. (Can be order ID)
  • $description (text, optional): Description text to display on payment page/invoice.
  • $userDefinedValuesArr (array, optional): Custom values to be sent and receive as postback. (Eg: verification data)
  • $merchantID (optional): Custom merchant other than config file, use this argument if you intend to use multiple accounts for payment.
  • $merchantSecret (optional): Use the secret key related to the custom merchantID
  • $currencyCode (optional): Use this argument if you intend to use multiple Currency payments. Available options: "NPR", "USD"
  • $nonSecure (optional): Use this argument to enable/disable OTP authentication. Available options: "Y", "N" (Y means disable)

Examples

Example with just amount

$amount = 250;
Hbl::payment($amount); // This will create and redirect to the payment page of Rs/$ 250

Example with more arguments

// $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);

Example with full arguments

// $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

Important Notes

  • Route names: hbl.index, hbl.error are created by the package, please do not override.
  • Custom Views: Create custom views folder under resources/views/vendor/hbl/, copy the original view files from: vendor/thebikramlama/hbl/src/views/

Credits

License

The MIT License (MIT). Please see License File for more information.