Setting Up Online Payments for Your Nepali Website: Khalti & eSewa Integration
Integrating Khalti and eSewa payment gateways into your Nepali website is crucial for accepting online payments, enhancing customer convenience, and boosting sales for your Nepali e-commerce store or service. This guide provides a complete, step-by-step process for businesses, startups, and NGOs in Nepal.
Key facts: * Primary Payment Gateways: Khalti and eSewa are dominant in Nepal. * Target Audience: Nepali SMBs, e-commerce operators, startups, NGOs. * Benefits: Increased sales, wider customer reach, streamlined transactions. * Integration Time: Can range from a few hours to a few days, depending on website complexity. * Cost: Typically includes transaction fees and potential setup fees from the payment gateway providers.
Overview of Online Payments in Nepal
The digital payment landscape in Nepal has seen significant growth, driven by increasing internet penetration and smartphone adoption. For any Nepali e-commerce business or Kathmandu startup, offering local payment options like Khalti and eSewa is no longer a luxury but a necessity. These platforms cater to millions of users across the country, providing a familiar and trusted way to transact.
According to a 2025 report by the Nepal Telecommunications Authority (NTA), digital payment transactions in Nepal grew by 45% year-on-year, indicating a strong shift towards cashless transactions. This trend underscores the importance of integrating these gateways for any business operating with a .np or .com.np domain.
Why Khalti and eSewa are Essential for Nepali Businesses
Khalti and eSewa are the two leading mobile wallet and online payment service providers in Nepal. They offer a wide array of services, from utility bill payments to online shopping, making them indispensable for everyday transactions. For businesses, integrating these gateways means:
* Wider Customer Reach: Access to millions of users who prefer or exclusively use these platforms. * Increased Sales: Reduced cart abandonment rates by offering preferred local payment methods. * Trust and Convenience: Customers feel more secure and find it easier to complete purchases. * Faster Transactions: Instant payment confirmations and quicker settlement times compared to traditional bank transfers.
For example, a small business in Kathmandu selling handicrafts online can significantly expand its market by allowing customers across Nepal to pay via Khalti or eSewa, rather than relying solely on cash-on-delivery or bank deposits.
Prerequisites for Integration
Before you begin the integration process, ensure you have the following:
* Registered Business: A legally registered business entity in Nepal. * Bank Account: A corporate bank account in a Nepali bank (e.g., Nabil Bank, Everest Bank). * Website: A functional website (WordPress, custom PHP, etc.) with a secure hosting environment from providers like Hosting Nepal. * SSL Certificate: An active SSL certificate (HTTPS) to secure transactions and build customer trust. Hosting Nepal offers free Let's Encrypt SSL certificates with all hosting plans. * API Documentation: Access to the developer documentation for Khalti and eSewa (provided after merchant registration).
Step-by-Step Guide to Integrating Khalti and eSewa
Integrating these payment gateways involves both administrative setup and technical implementation. Follow these steps carefully to ensure a smooth process for your Nepal SMB or e-commerce platform.
1. Merchant Account Registration
This is the initial and most crucial step. You need to register your business as a merchant with both Khalti and eSewa.
* Khalti Merchant Registration: Visit the Khalti merchant portal, fill out the application form with your business details (PAN/VAT number, company registration certificate, bank details). You'll typically need to submit scanned copies of legal documents. The approval process can take 3-7 business days. * eSewa Merchant Registration: Similar to Khalti, navigate to the eSewa merchant registration page. Provide your business information, including your company's legal name, contact person, and bank account details. eSewa also requires documentation like company registration, PAN/VAT, and a copy of the owner's citizenship. Approval usually takes 2-5 business days.
Once approved, you will receive your merchant ID, API keys (public and secret keys), and access to their respective merchant dashboards and developer documentation.
2. Choosing Your Integration Method
There are generally two ways to integrate payment gateways:
* Plugins/Extensions: If your website is built on a popular Content Management System (CMS) like WordPress with WooCommerce, Shopify, or OpenCart, there are often official or third-party plugins available. These simplify the integration significantly, requiring minimal coding. * Custom API Integration: For custom-built websites or specific requirements, you will need to integrate directly using their Application Programming Interface (API). This requires a developer with knowledge of web programming languages (PHP, Python, Node.js, etc.).
For most Nepali SMBs and startups using WordPress, plugins are the recommended and easiest route. Hosting Nepal provides optimized WordPress hosting that ensures these plugins run smoothly.
3. Technical Integration
This section details the actual technical setup. We'll focus on the plugin method, which is common for Nepali e-commerce sites.
#### For WordPress/WooCommerce Users:
1. Install Plugins: From your WordPress dashboard, go to Plugins > Add New. Search for "Khalti for WooCommerce" and "eSewa for WooCommerce". Install and activate both plugins.
2. Configure Khalti Plugin: Go to WooCommerce > Settings > Payments. You'll see Khalti listed. Enable it. Enter your Khalti Merchant ID, Public Key, and Secret Key (obtained during merchant registration). Set the payment title and description. Ensure you configure the "Success URL" and "Failure URL" in your Khalti merchant dashboard to point back to appropriate pages on your website.
3. Configure eSewa Plugin: Similarly, enable eSewa under WooCommerce > Settings > Payments. Input your eSewa Merchant ID and other required API credentials. Configure the Success URL and Failure URL within the eSewa merchant panel to ensure proper redirection after payment.
4. Test Transactions: Crucially, perform test transactions in both "Test Mode" (if available in the plugin settings) and then with small live amounts to ensure everything is working correctly. Check payment confirmations, order status updates, and fund transfers to your merchant account.
#### For Custom Websites:
1. Refer to API Documentation: Download and thoroughly read the official Khalti and eSewa API documentation. This will detail the endpoints, request parameters, and response formats. 2. Server-Side Integration: Your developer will need to write server-side code (e.g., PHP, Node.js) to handle payment requests. This involves: * Generating a unique transaction ID. * Sending payment requests to the gateway's API with order details. * Receiving callbacks/webhooks from the gateway to update order status. * Verifying payment signatures for security. 3. Client-Side Integration: Implement client-side code (HTML, JavaScript) to create payment buttons or forms that initiate the payment process, redirect users to the payment gateway, and handle redirects back to your website. 4. Security: Always use HTTPS. Store API keys securely (e.g., in environment variables, not directly in code). Validate all incoming payment notifications.
4. Testing and Go-Live
Thorough testing is paramount before making your payment gateways live. Test various scenarios:
* Successful payments. * Failed payments (e.g., insufficient balance). * Cancelled payments. * Refund processes (if applicable). * Different product types and price points.
Ensure that order statuses are updated correctly in your website's backend, and customers receive appropriate notifications. Once confident, switch from "Test Mode" to "Live Mode" in your plugin or code configuration.
Common Issues and Troubleshooting
Even with careful setup, you might encounter issues. Here are some common problems and their solutions:
* Invalid API Keys/Credentials: Double-check that your Merchant ID, Public Key, and Secret Key are entered correctly in your website's settings and match those provided by Khalti/eSewa. A common mistake is using test keys in a live environment or vice-versa. * Callback/Webhook Issues: If your website isn't receiving payment confirmations, ensure your "Success URL" and "Failure URL" are correctly configured in the payment gateway's merchant dashboard. Also, verify that your server's firewall isn't blocking incoming connections from the payment gateway's servers. Hosting Nepal's support team can assist with firewall configurations. * SSL Certificate Errors: Browsers will block insecure payment attempts. Ensure your website has a valid, active SSL certificate installed and is accessible via HTTPS. If you're using Hosting Nepal, check your cPanel for SSL status or contact support. * Insufficient Funds/Payment Failures: These are often customer-side issues. However, ensure your integration handles these scenarios gracefully, providing clear messages to the user. * Plugin Conflicts (for WordPress): Sometimes, other plugins might interfere. Try deactivating other plugins temporarily to identify conflicts. Keep all plugins and WordPress core updated. * Currency Mismatch: Ensure your website's default currency is set to NPR if the payment gateway expects it.
Conclusion
Integrating Khalti and eSewa is a vital step for any Nepali website looking to thrive in the digital economy. By following this comprehensive guide, your Nepal SMB, e-commerce store, or Kathmandu startup can confidently set up online payment processing, offering convenience to your customers and streamlining your operations. Remember to choose a reliable hosting provider like Hosting Nepal to ensure your website and payment gateways perform optimally and securely. With these integrations, you're well-equipped to capture a larger share of Nepal's growing online market.
