Skip to content

Instantly share code, notes, and snippets.

@sachinkiranti
Last active December 26, 2021 04:33
Show Gist options
  • Save sachinkiranti/750ac3370ffaa351803e21c00b729ff7 to your computer and use it in GitHub Desktop.
Save sachinkiranti/750ac3370ffaa351803e21c00b729ff7 to your computer and use it in GitHub Desktop.
Himalayan Bank Payment Gateway
<?php
/**
*
* Himalayan Bank Payment Gateway
* Prod endpoint : https://hblpgw.2c2p.com/HBLPGW/Payment/Payment/Payment
* Dev endpoint : https://hbl.pgw/payment
*
* HTTP status code :
*
* 00 Approved ,transaction is successfully paid.
* 03 Invalid merchant id
* 524 currency code for Nepalese currency
* 840 currency code for United States dollar
*
* @version 1.0
*
*/
?>
<form method="post" action="https://hblpgw.2c2p.com/HBLPGW/Payment/Payment/Payment">
<input type="text" id="paymentGatewayID" name="paymentGatewayID" value="Ex: MechantId"/>
<input type="text" id="invoiceNo" name="invoiceNo" value="00000001234567890333"/>
<input type="text" id="productDesc" name="productDesc" value="Test Product"/>
<input type="text" id="amount" name="amount" value="000000010000"/>
<input type="text" id="currencyCode" name="currencyCode" value="Ex: 524"/>
<input type="text" id="userDefined1" name="userDefined1" value="custom data"/>
<input type="text" id="nonSecure" name="nonSecure" value="Y"/>
<input type="text" id="hashValue" name="hashValue" value="94E8E91C29E73B9648011FADBAE19849B520B24B"/>
</form>
<?php
/**
*
* Hashing function
*
* Hash value is computed using HMACSHA256 algorithm with merchant secret key
* (provided by HBL to merchant).
*
* HashValue = merchantID + invoiceNumber + amount + currencyCode + nonSecure
*
* @version 1.0
*
*/
$signData = hash_hmac('SHA256', "signatureString",'SecretKey', false);
$signData = strtoupper($signData);
echo urlencode($signData);
?>
@sachinkiranti
Copy link
Author

@riwash g in which programming are you trying to implement this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment