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
Your business
Amount to payNPR 2,500.00Order #1001

Choose how to pay

  • eSewaLog in to your eSewa wallet to pay
  • KhaltiKhalti wallet, mobile banking or internet banking
  • FonepayScan a QR code with any mobile banking app
Continue with eSewa

Powered by Paymentsnp

How eSewa works in Paymentsnp. Five steps, two of them are checks.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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
eSewa ePay request and status lookup
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 and the Paymentsnp result
eSewa statusPaymentsnp resultWhat happens next
COMPLETESucceededOrder paid, webhook sent, receipt sent to the customer
CANCELEDFailedThe customer can try again or pick another method
PENDING, AMBIGUOUS, NOT_FOUNDPendingChecked again in the background; a second payment is blocked meanwhile
Amount or attempt mismatchNot paidRejected 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.

Requirements for eSewa
Merchant accountAn approved eSewa merchant account with ePay access
CredentialsThe product code and secret key eSewa gives you
EnvironmentsSeparate test and live credentials
Order of workeSewa UAT first, then live credentials
Minimum amountNone 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.