Skip to content

Demo: https://hbl.bikramlama.com.np/ πŸ› Himalayan Bank Ltd Payment Integration - Laravel Package

License

Notifications You must be signed in to change notification settings

TheBikramLama/hbl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NO LONGER WORKING

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.