eSewa & Khalti Payment Gateway Integration Guide for E-commerce
A simple step-by-step guide to integrate eSewa and Khalti payment gateways into your e-commerce website. Learn how to register as a merchant, set up API credentials, configure callbacks, test, and go live.
October 19, 2025
03:37 PM
eSewa

eSewa Payment Integration Guide

Introduction

eSewa is one of Nepal’s leading digital wallets, allowing customers to make easy and secure online payments. Integrating eSewa as a payment method in your e-commerce website enables your customers to pay conveniently using their eSewa accounts.

Overview

To accept payments via eSewa, your business needs to register as a merchant with eSewa. Once registered, you receive API credentials that allow your website to communicate with eSewa’s payment gateway. After integration, when customers select eSewa during checkout, payments are processed securely through eSewa’s platform and the payment status is communicated back to your website.

Step-by-step Guide to Integrate eSewa Payment

Step 1: Register as an eSewa Merchant

  • Open your browser and go to: https://merchant.esewa.com.np/auth/register-merchant
  • Fill out the form with your business details (name, address, contact info).
  • Upload the necessary documents (business license, identity proof, etc.).
  • Submit the form and wait for eSewa to approve your registration. This can take a few days.

Step 2: Log in to Your Merchant Account and Get API Credentials

  • After approval, go to: https://merchant.esewa.com.np
  • Log in with your credentials.
  • Find the API Settings or Integration section in the menu.
  • Here, you will see your Merchant ID and API Key — copy these carefully.
  • These keys allow your website to talk securely to eSewa’s system.

Step 3: Set Up Your Website’s Callback URL (Webhook)

  • Your website needs a special web address (called a callback URL) where eSewa will send payment status updates.
  • This URL must be accessible to the internet (anyone can reach it, no login required).
  • In the eSewa merchant dashboard, go to API Settings or Webhook Settings.
  • Enter your website’s callback URL in the field provided and save it.
  • Example: https://yourwebsite.com/esewa/callback

Step 4: Connect Your Website to eSewa

  • Use the Merchant ID and API Key in your website’s payment module or system.
  • When a customer chooses eSewa to pay, your website sends the payment request to eSewa using these keys.
  • After payment, eSewa will send the payment result to your callback URL.
  • Your website must listen for this message and update the order/payment status (paid or failed).

Step 5: Test Your Integration

  • eSewa provides a sandbox (test) environment where you can simulate payments without real money.
  • Use sandbox mode to check if payments and callbacks are working correctly.

Step 6: Go Live

  • Once testing is successful, switch your integration from sandbox to live mode.
  • Start accepting real payments from customers through eSewa.

Khalti Payment Gateway Integration Guide

Introduction

Khalti is a popular digital wallet in Nepal that lets people pay online easily and securely. By adding Khalti as a payment option on your e-commerce website, your customers can pay using their Khalti wallet quickly.

Overview

Khalti provides a payment platform for businesses (merchants) to accept digital payments. To use Khalti, merchants need to register, integrate Khalti’s payment system into their website or app, and connect their accounts to receive payments.

Step-by-step Guide to Integrate Khalti Payment

Step 1: Register as a Khalti Merchant

  • Visit Khalti’s merchant signup page: https://khalti.com/merchant/
  • Fill out your business info and submit required documents.
  • Wait for Khalti to approve your registration.

Step 2: Log in and Get API Credentials

  • After approval, log in at: https://khalti.com/merchant/
  • Go to API Keys or Integration Settings.
  • Copy your Merchant ID and Secret Key.
  • These keys help your website communicate with Khalti’s payment system.

Step 3: Set Up Callback URL (Webhook)

  • Create a public URL on your website where Khalti can send payment status updates.
  • In the Khalti merchant dashboard, go to Webhook Settings.
  • Enter your callback URL (e.g., https://yourwebsite.com/khalti/callback) and save.

Step 4: Connect Your Website to Khalti

  • Use the Merchant ID and Secret Key in your website’s payment setup.
  • When a customer pays via Khalti, your website sends payment data to Khalti.
  • Khalti sends payment status back to your callback URL.
  • Your website must receive this and update the order/payment status.

Step 5: Test Your Integration

  • Use Khalti’s sandbox mode for testing payments without real money.
  • Check that payments and callbacks work correctly.

Step 6: Go Live

  • Switch from sandbox to live mode.
  • Start accepting real payments via Khalti.