About HafirPay What inspired me:

I kept seeing small businesses in my community — tailors, market vendors, freelance designers — losing customers because they couldn't accept digital payments. Stripe doesn't exist in their country. PayPal holds their money for weeks. Local gateways charge 5-10% fees that eat into already thin margins. I realized the problem wasn't technical — it was access. If someone has a bank account, they should be able to get paid. That's it. No approval process, no business registration, no gatekeeping.

What I built:

HafirPay is a modern payment gateway that works anywhere banks exist. A merchant signs up in 2 minutes, adds their bank details, and gets a payment link. When a customer clicks it, they see a clean checkout page with the bank details and a QR code. The money goes directly from the customer to the merchant's bank — no middleman, no fees, no waiting.

I also built an Agent API system — dedicated API keys that AI agents can use to create payment links and send invoices automatically. This means a chatbot, an automation workflow, or any AI system can process payments without human intervention. I believe the future of commerce is agent-to-agent, and HafirPay is built for that.

How I built it:

I started with Node.js and Express for the backend, SQLite for the database, and vanilla JavaScript for the frontend. The UI uses glassmorphism, animated gradients, and a dark theme — I wanted it to feel premium and modern, not like a typical fintech tool from 2015.

For production, I deployed everything on Cloudflare Workers with D1 database — serverless, fast, and free tier. The entire backend runs at Cloudflare's edge, meaning low latency no matter where the merchant or customer is in the world.

The email invoicing system uses Nodemailer — merchants configure their SMTP once, then can send professional HTML invoices with one click or via the API.

Challenges I faced:

Cloudflare Workers don't support SQLite — I had to rewrite the entire backend from better-sqlite3 to Cloudflare D1, which uses a different query API (.bind() instead of direct parameters). This took hours of debugging. No native bcrypt in Workers — I had to implement password hashing using Web Crypto API with SHA-256 + salt instead of bcryptjs. QR code generation without libraries — Cloudflare Workers can't import npm packages easily, so I wrote a custom QR code generator using SVG and hash-based patterns. Single-file architecture — Everything (API + frontend HTML + checkout page) is bundled into one Cloudflare Worker file. Keeping it organized while maintaining readability was a real challenge. Windows PowerShell compatibility — Bash commands don't work the same way on Windows. Every && had to be replaced with ;, every & with Start-Process. Simple tasks became multi-step problems. What I learned:

How payment gateways actually work behind the scenes Cloudflare Workers and D1 — the future of serverless Building for the underserved means building for constraints Sometimes the simplest solution (direct bank transfer) is the best one AI agents need payment infrastructure too — that's a space nobody's building for ye

Built With

  • backend:-node.js
  • custom
  • dark
  • design:
  • express.js
  • modern
  • nodemailer
  • theme
  • with
Share this project:

Updates