In the world of web hosting, automation is the difference between a side hustle and a scalable business. If you are running a reseller hosting business in Nepal in 2026, you cannot afford to manually check bank transfers or verify eSewa screenshots on Viber. Your customers expect instant service activation. They want to pay at 2:00 AM and have their hosting account ready by 2:01 AM.
To achieve this, you need a robust integration between WHMCS (Web Host Manager Complete Solution) and Nepalโs leading payment gateways: eSewa, Khalti, and Fonepay.
As part of our Week 2 Deep Dive, we are moving past the “why” and getting into the “how.” This guide will walk you through the technical setup, merchant requirements, and automation logic needed to turn your WHMCS installation into a self-sustaining revenue machine.
The Business Case for Payment Automation in Nepal
Before we touch the code, let’s look at the numbers. A typical reseller in Pokhara spends approximately 4-6 hours a week manually verifying payments. With the Nepal E-commerce Act of 2025 now in full effect, consumer expectations for “Instant Fulfillment” have peaked.
Benefits of Integration:
- Zero Human Intervention: Invoices are marked “Paid” automatically.
- Instant Provisioning: WHMCS tells cPanel/WHM to create the account immediately upon payment.
- Reduced Churn: Customers are less likely to leave if the renewal process is friction-free.
- Professionalism: A professional checkout experience builds trust, which is the #1 currency in the hosting industry.
Pre-Requisites: Preparing Your WHMCS Environment
Before installing any modules, your infrastructure must be ready. 2026 standards require higher security and specific localization.
I. SSL & HTTPS (Mandatory)
All Nepali gateways (especially eSewa v2 and Khalti) require a secure callback environment. Your WHMCS must be running on https://. Ensure your SSL certificate is valid and not expired.
II. Currency Configuration
Most resellers pay their upstream providers (like PokharaHost or international data centers) in USD but charge local clients in NPR.
- Go to Setup > Payments > Currencies.
- Add NPR as a currency.
- Set the Base Conversion Rate. (Pro Tip: Use the “Update Exchange Rates” button, but add a 2-3% “Forex Buffer” to cover bank conversion fees).
III. System Cron Job
Ensure your WHMCS Cron is running every 5 minutes. Without a functioning cron, the automation “handshake” between the gateway and your server might fail.
Integrating eSewa (v2 API)
eSewa remains the “Big Brother” of digital wallets in Nepal. In late 2025, they fully deprecated the v1 API in favor of eSewa ePay v2, which uses more secure HMAC-SHA256 signatures.
Step 1: Merchant Account Setup
You cannot use a personal eSewa account for WHMCS.
- Requirements: Company Registration, PAN/VAT Certificate, and a Business Bank Account.
- Access: Sign up at the eSewa Merchant Portal.
- Keys Needed: You will receive a
Merchant ID, aSecret Key(for HMAC), and aProduct Code.
Step 2: Module Installation
- Download a compatible eSewa v2 WHMCS module (check the WHMCS Marketplace).
- Upload the files to
/modules/gateways/. You should seeesewa.phpand a callback file in/modules/gateways/callback/esewa.php. - In WHMCS Admin, go to System Settings > Payment Gateways > All Gateways and activate eSewa.
Step 3: Configuration
- Merchant ID: Enter your official ID.
- Secret Key: Paste the HMAC key.
- Service Delivery Charge: (Optional) If you want to pass the eSewa fee to the customer.
- Test Mode: Keep this enabled until you complete a successful transaction in the eSewa Sandbox.
Integrating Khalti: The Developerโs Choice
Khalti is widely praised for its clean API documentation and reliable “Lookup” system. After their merger with IME Pay, their reach has expanded significantly.
The Technical Flow
Unlike eSewa, which often relies on a POST redirect, Khalti uses a pidx (Payment ID) system.
- WHMCS requests a
pidxfrom Khalti. - The customer is redirected to the Khalti payment page.
- After payment, Khalti redirects back to your WHMCS with a transaction status.
Step 1: Getting API Keys
- Visit the Khalti Merchant Dashboard.
- Go to Settings > API Keys.
- You will need the Live Secret Key.
Step 2: Module Configuration
Most Khalti modules for WHMCS require you to define the Currency as NPR.
- Conversion: If your invoice is in USD, ensure the module is set to “Convert to For Processing.” Khalti will only accept the final amount in Paisa (100 Paisa = 1 NPR).
- Callback URL: Usually
https://yourdomain.com/modules/gateways/callback/khaltigateway.php. - Internal Link: For a comparison of performance, see our Best Web Hosting in Nepal 2026 guide.
Integrating Fonepay (Dynamic QR)
Fonepay is not a wallet; it is a network. This makes it unique because a customer can pay your Fonepay QR using any banking app in Nepal. In 2026, the gold standard is Dynamic QR.
Static vs. Dynamic QR
- Static QR: A fixed sticker on your wall. The customer has to type the amount. (Bad for automation).
- Dynamic QR: WHMCS generates a unique QR code for that specific invoice and that specific amount. When the customer scans it, the amount is pre-filled. Once they hit pay, WHMCS is notified instantly.
Step 1: Registration via Bank
You usually cannot get a Fonepay merchant account directly from Fonepay. You must visit your bank (e.g., Nabil, Global IME, NIC Asia) and request Fonepay Merchant QR Integration.
- Ask specifically for API Access for Dynamic QR.
Step 2: Module Setup
Modules like those from WHMPress or AGM Web Hosting allow you to embed the Fonepay QR directly on the WHMCS invoice page.
- Merchant Code: Provided by your bank.
- Password/Secret: Provided for API authentication.
Advanced Automation: The “Reseller Hosting” Logic
As a reseller, you aren’t just taking money; you are managing a lifecycle.
I. Tax & Service Fees
In Nepal, gateways often charge between 1.5% and 3% per transaction.
- Decision: Do you absorb the cost or pass it to the customer? WHMCS allows you to add a “Payment Gateway Surcharge,” but be carefulโunder the new consumer laws, hidden fees can lead to complaints. It is often better to price your hosting slightly higher and offer “Free eSewa Payments.”
II. Multi-Currency Handling
If you sell to international clients via Stripe/PayPal AND local clients via eSewa:
- Set USD as your Default Currency.
- Ensure eSewa/Khalti modules are set to convert USD to NPR using the current exchange rate at the moment of checkout.
III. Automated Provisioning
Go to Products/Services > Edit Product > Module Settings.
- Select “Automatically setup the product as soon as the first payment is received.”
- This ensures that the moment the eSewa callback hits your site, the customer gets their “Welcome Email” with their cPanel login details.
Troubleshooting Common Errors
1. The “Paid but Pending” Problem
This is the most common issue where a customer pays, but the invoice remains “Unpaid.”
- Cause: The gateway’s callback (IPN) was blocked by your server’s firewall (ModSecurity) or your site’s SSL is invalid.
- Fix: Whitelist the gateway IPs in your server and check the Gateway Log (Billing > Gateway Log) in WHMCS to see the error message.
2. HMAC Signature Mismatch
- Cause: Using an old v1 module with a v2 Secret Key, or vice-versa.
- Fix: Ensure your module version matches the API version of the provider.
3. cURL Timeout
- Cause: Your server cannot “talk” to the eSewa/Khalti servers.
- Fix: Contact your hosting provider (like PokharaHost) to ensure outgoing connections to Nepali payment IPs are open.
Compliance & Security: The 2026 Checklist
With the Nepal Data Privacy Act, how you handle payment data matters.
- Never Store Wallet Pins: WHMCS gateways should only handle the transaction token, never the customerโs eSewa or Khalti password.
- Audit Logs: Regularly check your Gateway Logs for suspicious failed attempts.
- Refunds: WHMCS doesn’t always support automated refunds for Nepali gateways. Most refunds must be done manually via the Merchant Portal, then marked as “Refunded” in WHMCS.
Exhaustive FAQ: WHMCS Payments in Nepal
Q1: Can I use one eSewa merchant account for multiple WHMCS sites? A: No. Each Merchant ID is usually tied to a specific domain. You should request separate sub-accounts if you run multiple brands.
Q2: Is there a free WHMCS module for Khalti? A: Yes, Khalti provides an official module on GitHub, though third-party premium modules often offer better “one-click” setup and support.
Q3: How do I handle VAT in WHMCS for Nepal? A: Go to Setup > Tax Rules. Add a 13% tax rule for “Nepal.” Ensure your product prices are set to “Tax Exclusive” so the 13% is added at checkout.
Q4: Does Fonepay support international cards in WHMCS? A: Yes! If you use the Fonepay network, customers can often pay using international travel cards or UPI (from India), making it great for resellers targeting the SAARC region.
Q5: What is the best way to test before going live? A: Always use the Sandbox/Test URLs. For eSewa, you can use the test credentials provided in their docs. Never test with live money until the sandbox “Handshake” is 100% successful.
Conclusion: Building a Frictionless Hosting Brand
Setting up eSewa, Khalti, and Fonepay with WHMCS is a significant technical milestone. It marks the transition from a manual operator to a professional Hosting Provider.
In the competitive Nepali market, speed is your greatest weapon. When a developer in Kathmandu needs a VPS at midnight to fix a bug, the host that allows them to pay via Khalti and get instant access will always win.
Ready to automate? If you are a PokharaHost Reseller, our team can help you configure your gateway modules for free. Let’s get your business running 24/7.