npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-esewa

v1.1.31

Published

Production-ready n8n community node for the official eSewa ePay API

Downloads

1,225

Readme

n8n-nodes-esewa

Production-ready n8n community node for the official eSewa ePay API.

Features

  • Create payment form payloads for eSewa ePay.
  • Verify payment status with the official status check API.
  • Decode Base64 success callback payloads.
  • Uses the sandbox endpoint automatically in Test.
  • Uses the live endpoint automatically in Production.
  • Keeps developer helper operations out of the default UI.

Installation

Community node installation

npm install n8n-nodes-esewa

Local development install

git clone <your-fork-or-repo-url>
cd n8n-nodes-esewa
npm install
npm run build

Copy the compiled dist folder into your n8n custom nodes location or link the package into your n8n environment.

Credentials

Create an Esewa API credential with:

  • Merchant/Product Code
  • Secret Key
  • Environment: Test (Sandbox) or Production

When you select Test (Sandbox), the credential UI shows sandbox-only guidance:

  • Uses https://rc-epay.esewa.com.np/api/epay/main/v2/form
  • Requires EPAYTEST
  • Requires the sandbox secret key

When you select Production, the credential UI shows live-payment guidance:

  • Uses https://epay.esewa.com.np/api/epay/main/v2/form
  • Requires a verified eSewa merchant account
  • Requires live credentials

The credential values are stored securely by n8n credential encryption.

Operations

Create Payment

Builds the eSewa form POST payload and returns:

  • environment
  • payment URL
  • generated signature
  • complete form payload
  • auto-submit HTML for Respond to Webhook

If total_amount is left blank, the node calculates it from amount + tax_amount + product_service_charge + product_delivery_charge.

The product code is read from the credential automatically.

Verify Payment

Calls the official status check endpoint with:

  • transaction_uuid
  • total_amount

The response includes the raw API response and a normalized status field.

Decode Success Response

Decodes the Base64 callback payload returned by eSewa after successful payment.

Why eSewa Returns HTTP 405

The payment endpoint is a form submission endpoint. Opening it directly in a browser issues a GET request, but eSewa only accepts POST for payment creation. That is why direct navigation returns HTTP 405 Method Not Allowed.

Webhook Redirect Example

Use this workflow:

Webhook -> eSewa Create Payment -> Respond to Webhook

In Respond to Webhook:

  • Response Type: Text
  • Content: {{$json.auto_submit_html}}
  • Content-Type: text/html

This returns an HTML page that immediately auto-submits the form to the official eSewa endpoint.

HTML Response Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Redirecting to eSewa...</title>
</head>
<body onload="document.forms[0].submit()">
  <p>Redirecting to eSewa...</p>
  <form action="https://rc-epay.esewa.com.np/api/epay/main/v2/form" method="POST">
    <input type="hidden" name="amount" value="100">
    <input type="hidden" name="tax_amount" value="10">
    <input type="hidden" name="product_service_charge" value="0">
    <input type="hidden" name="product_delivery_charge" value="0">
    <input type="hidden" name="total_amount" value="110">
    <input type="hidden" name="transaction_uuid" value="241028">
    <input type="hidden" name="product_code" value="EPAYTEST">
    <input type="hidden" name="success_url" value="https://example.com/success">
    <input type="hidden" name="failure_url" value="https://example.com/failure">
    <input type="hidden" name="signed_field_names" value="total_amount,transaction_uuid,product_code">
    <input type="hidden" name="signature" value="...">
  </form>
</body>
</html>

Troubleshooting

  • If the browser shows HTTP 405, do not open the payment URL directly. Use the generated HTML redirect page.
  • If the total amount is wrong, leave total_amount empty so the node calculates it from the upper fields.
  • If the signature fails, verify that the signed fields are still total_amount,transaction_uuid,product_code.

Development

npm install
npm run watch

Build

npm run build

Testing

npm test

The included tests cover:

  • signature generation against the published eSewa example
  • Base64 callback decoding
  • validation helpers
  • signature verification logic

Example Workflows

1. eCommerce checkout

Webhook -> MySQL -> Create Payment -> Respond to Webhook

2. Payment verification

Webhook -> Verify Payment -> IF -> Update Database

3. Payment callback

Webhook -> Decode Response -> Verify Payment -> Send Email -> Update MySQL

API Examples

Create payment form payload

{
  "amount": "100",
  "tax_amount": "10",
  "product_service_charge": "0",
  "product_delivery_charge": "0",
  "total_amount": "110",
  "transaction_uuid": "241028",
  "success_url": "https://example.com/success",
  "failure_url": "https://example.com/failure"
}

Verify payment

{
  "transaction_uuid": "241028",
  "total_amount": "110"
}

Screenshots

Add screenshots here as placeholders in your documentation pipeline:

  • docs/screenshots/create-payment.png
  • docs/screenshots/verify-payment.png
  • docs/screenshots/credentials.png

Troubleshooting

  • Signature mismatch: confirm the payload order is exactly total_amount,transaction_uuid,product_code.
  • Invalid UUID: use only alphanumeric characters and hyphens.
  • URL validation errors: make sure success and failure URLs start with http:// or https://.
  • Status check failures: verify the environment and product code match the original payment request.

FAQ

Does this node support sandbox and production?

Yes. Test always uses the sandbox endpoint and Production always uses the live endpoint.

Can I use the output with Respond to Webhook?

Yes. The node returns normal JSON objects that are compatible with downstream webhook responses.

Is the credential encrypted by n8n?

Yes. n8n stores credential values encrypted at rest using its credential storage.

License

MIT