eSewa in Paymentsnp checkout
Customers pay with their eSewa wallet on eSewa's own ePay page. Paymentsnp signs the request, checks eSewa's signed reply and then asks eSewa for the status with the exact amount before an order counts as paid.
- Payments settle to your own eSewa merchant account
- No minimum amount set by Paymentsnp
- Customers log in only on eSewa's page
Choose how to pay
Log in to your eSewa wallet to payKhalti wallet, mobile banking or internet banking
Scan a QR code with any mobile banking app
Powered by Paymentsnp
How eSewa works in Paymentsnp. Five steps, two of them are checks.
A signed form
When the customer chooses eSewa, our server builds an ePay form and signs the total, the attempt id and your product code with your secret key using HMAC-SHA256. The browser posts it to eSewa.
eSewa's own page
The customer logs in to eSewa on eSewa's ePay page and approves the payment. Their eSewa ID, password and OTP never reach Paymentsnp.
Callback signature
eSewa sends the customer back with a signed reply. We recompute the signature and compare the attempt, product code and amount. A reply that does not match is rejected.
Status lookup, always
We then ask eSewa's transaction status API about this attempt with the exact amount. Only COMPLETE for the right amount marks the order paid. This lookup is mandatory, even after a valid signature.
Background re-check
If eSewa says the payment is pending, or the customer never comes back, a worker keeps asking eSewa with growing gaps, up to 20 checks over about 14 hours, and stops on an amount mismatch.
What we send and what we ask. The fields come from the code.
These are the fields Paymentsnp sends eSewa for a Rs 2,500 order and the lookup it makes afterwards. Test mode uses eSewa's test hosts instead.
- Signed fields
total_amount, transaction_uuid, product_code- Signature
- HMAC-SHA256 with your eSewa secret key
- Amount
- Taken from the order, never from the browser
- Your secret
- Encrypted at rest, never shown back to you or to platform admins
POST https://epay.esewa.com.np/api/epay/main/v2/form
amount = 2500.00
tax_amount = 0
total_amount = 2500.00
transaction_uuid = <payment attempt id>
product_code = <your eSewa product code>
product_service_charge = 0
product_delivery_charge = 0
success_url = <checkout return URL>
failure_url = <checkout return URL>
signed_field_names = total_amount,transaction_uuid,product_code
signature = <HMAC-SHA256 of the signed fields, base64>GET https://epay.esewa.com.np/api/epay/transaction/status/
?product_code=<your eSewa product code>
&total_amount=2500.00
&transaction_uuid=<payment attempt id>How we read eSewa's answer. Unclear means pending, never paid.
| eSewa status | Paymentsnp result | What happens next |
|---|---|---|
COMPLETE | Succeeded | Order paid, webhook sent, receipt sent to the customer |
CANCELED | Failed | The customer can try again or pick another method |
PENDING, AMBIGUOUS, NOT_FOUND | Pending | Checked again in the background; a second payment is blocked meanwhile |
| Amount or attempt mismatch | Not paid | Rejected and never marked paid |
What you need. From eSewa, before Live.
Paymentsnp does not open eSewa accounts for you. You apply to eSewa as a merchant and then paste your own credentials into Paymentsnp.
| Merchant account | An approved eSewa merchant account with ePay access |
|---|---|
| Credentials | The product code and secret key eSewa gives you |
| Environments | Separate test and live credentials |
| Order of work | eSewa UAT first, then live credentials |
| Minimum amount | None set by Paymentsnp |
Saving your credentials
When you save a product code and secret key, Paymentsnp first checks them with eSewa for the environment you are in. If eSewa does not accept them, nothing is saved. Saving does not switch eSewa on; you enable it yourself, separately for Test and Live.
Settlement, fees and refunds stay between you and eSewa. If you refund a customer in eSewa's panel, you record that refund in Paymentsnp so your records match.
eSewa ePay developer information (opens in a new tab)Questions about eSewa.
When does eSewa money reach my account?
Settlement timing is set by your agreement with eSewa. The money goes from eSewa to your own eSewa merchant account; Paymentsnp never holds it.
What fees apply to eSewa payments?
eSewa's fees follow your agreement with eSewa. Paymentsnp does not set, show or change them.
Is there a minimum amount for eSewa?
Paymentsnp sets no minimum for eSewa. Any limits in your own eSewa agreement still apply.
What if the customer closes the page after paying?
The background worker keeps asking eSewa about the attempt. If eSewa reports it complete, the order is recorded as paid, even after the 30 minute expiry.
Can I test eSewa before going live?
Yes. Save your eSewa test credentials in Test mode and pay on eSewa's test environment. The Sandbox gateway also lets you test without any eSewa account.