There are four steps for integrating Khalti payment to a merchant system.
- 1. Signup as merchant
- 2. Understand how khalti payment works
- 3. Test integration
- 4. Deploy integration
1. Signup as merchant¶
First of all you will need a merchant and a consumer accounts. Merchant is an online business service like e-commerce websites, ISP online payment, Movie online purchase etc. Consumer is an end user who uses Khalti to purchase products or services from merchants.
Please follow links below to create a merchant and a consumer accounts if you have not already.
2. Understand Khalti payment process¶
2.1. Transaction States¶
It is the first state of a transaction. Transactions are initiated after mobile number and other transaction details are provided.
A transaction is confirmed after transaction details (transaction token, confirmation_code and 3rd party transaction_pin) are provided by the consumer. Check how to set and update transaction pin here.
Merchant server then requests khalti server to verify the transaction. After the transaction is in completed state consumer is informed the transaction was successfully completed.
A transaction could be disabled due to the possibility of 'confirmation_code' exploitation.
A merchant can refund the successful payments within a limited period of time.
6. Partially refunded¶
A completed transaction also can be partially refunded.
Normally, a successful transaction has at least three changes of states initiate, confirm and complete. A client first initiates and then confirms payment while the server finally verifies it and the payment process is completed.
3. Test integration¶
Now that you know how Khalti payment works. Its time to integrate it into your system.
A merchant must complete test integration using test keys. Test keys start with
In test mode, transactions are sandboxed, which means fund is not moved from a consumer to the merchant. Khalti must to be integrated at client and server.
Payment via E-Banking and Debit/Credit card is not supported in the test environment. After you successfully integrate wallet, you need not to concern about E-Banking and Card payment integration.
3.1. Client side integration¶
For now there is only one way to integrate Khalti at client side, through SDKs.
We have developed SDKs for every major plaforms and we call it
Checkouts provide all the necessary UIs and perform necessary processes to initiate and confirm payment.
3.2. Server side integration¶
After user confirms payment, it has to be verified by Khalti. Fund from user account is moved to merchant only if verification succeeds. Verification must be done by the merchant server using a secret key.
4. Go live¶
After successful integration test, the merchant must replace test keys with live ones.
Live keys start with
test_secret_X keys with
live_secret_X keys respectively.
4.1. Further processes¶
Even successful integration itself doesn't let you receive payments above NRs. 1000 per transaction. Please fill KYC form and contact us at 9801165568 to remove the limits and accept payments without restrictions.