Apsan
HBL + 2C2P = JS Developer Nightmare

HBL + 2C2P = JS Developer Nightmare

#NextJS#HBL#2c2p

If you’re a JS developer struggling with HBL + 2C2P, this repo and write-up can save you weeks of frustration. Modern JS + JOSE encryption FTW.

Overview

Integrating HBL’s outdated payment gateway with 2C2P v2 in a modern JavaScript stack felt like a nightmare. The system’s ancient PHP roots, useless documentation, and non-existent support turned what should have been a few days’ work into 3 weeks of untangling chaos.


The Pain Points

Stuck on 2C2P v2: The PHP version was old, undocumented, and confusing.

No support: Any official guidance was basically non-existent.

Reverse engineering required: After wasting 2 weeks, I had to reverse-engineer their v2 payment flows in PHP just to understand what was happening.


The Solution


I rebuilt the entire integration in Next.js, with:

  • Secure JOSE encryption
  • Clean, maintainable payment flows
  • Modern architecture compatible with current JS standards

Finally, the payment flow works reliably, is maintainable, and no longer relies on obscure legacy PHP logic.


Resources

GitHub repo: Apsan1/hbl-payment-next


Collaborate with me

Contact me directly:

apsan@apsan.com.np
Signature