canonical: https://jentic.com/apis/esewa.com.np/esewa

# eSewa ePay API

Jentic publishes the only available OpenAPI specification for eSewa ePay API, keeping it validated and agent-ready. The eSewa ePay API lets merchants in Nepal accept payments through eSewa, Nepal's largest digital wallet, by redirecting customers to a hosted checkout form and verifying transactions afterwards. The integration is built around two HMAC-signed operations: initiating a payment with a unique transaction UUID and confirming the final status before fulfilment. Sandbox traffic is supported via the rc-epay.esewa.com.np host so merchants can rehearse the redirect, signature, and status-check flow before going live.

## For AI agents

Initiate eSewa wallet payments for Nepali customers and verify the final transaction status before releasing goods or services.

## Scope

Does not handle card vaulting, refunds, or payouts to merchant bank accounts - use for initiating and verifying eSewa wallet payments only.

## Capabilities

- Initiate an eSewa checkout redirect with a signed transaction UUID and amount payload
- Verify a completed eSewa payment by transaction UUID before fulfilling an order
- Generate HMAC SHA256 signatures for the signed_field_names body to authenticate requests
- Switch between production (epay.esewa.com.np) and rc-epay sandbox hosts for end-to-end testing
- Reconcile failed or cancelled checkout attempts using the transaction status response codes

## Use cases

### Nepali e-commerce checkout with eSewa wallet

Merchants selling to customers in Nepal redirect shoppers from their cart to the eSewa hosted form, where the buyer authorises payment from their eSewa wallet balance, mobile banking, or linked card. The merchant then calls the transaction status endpoint with the same UUID to confirm settlement before releasing the order. Because eSewa is the dominant wallet in Nepal, this flow typically lifts conversion meaningfully versus card-only checkouts.

Example prompt: Initiate an eSewa payment of NPR 2500 for transaction UUID 'ord-9931' by POSTing to `/api/epay/main/v2/form` with the HMAC-signed payload, then confirm settlement via GET `/api/epay/transaction/status.`

### Reconciliation of completed and failed eSewa transactions

Finance teams pull each completed checkout's status from `/api/epay/transaction/status` using the merchant transaction UUID and product code, matching it against internal order IDs. The endpoint returns a status string (COMPLETE, PENDING, FULL_REFUND, AMBIGUOUS, NOT_FOUND, CANCELED) so the team can flag stuck or refunded transactions and reissue or cancel orders accordingly. This avoids manually downloading dashboard reports.

Example prompt: For every order created today, call GET `/api/epay/transaction/status` with product_code 'EPAYTEST' and the order's transaction_uuid, then mark internal orders as paid, pending, or refunded based on the returned status.

### Sandbox rehearsal before going live in production

Before switching to the live host, integrators run the full payment flow against rc-epay.esewa.com.np with the test merchant code to verify that signature generation, redirect handling, and status verification all behave correctly. This catches HMAC formatting errors and transaction_uuid collisions before any real money moves. The same payload structure is used in both environments, so once sandbox passes, the production cutover is just a host swap.

Example prompt: Submit a test payment of NPR 100 to https://rc-epay.esewa.com.np/api/epay/main/v2/form with merchant code 'EPAYTEST' and a fresh UUID, then verify the resulting status is COMPLETE before flipping the base URL to production.

### AI agent collecting payments for a Nepali SaaS subscription

An AI agent acting on behalf of a Nepali SaaS provider discovers the eSewa ePay operations through Jentic's intent search, loads the input schema, and assembles a signed payment payload for the customer's subscription renewal. After redirecting the user, the agent polls the status endpoint until it returns COMPLETE and then activates the subscription in the SaaS database. Through Jentic, the merchant secret never leaves the vault.

Example prompt: Search Jentic for 'accept an eSewa wallet payment', load the `/api/epay/main/v2/form` schema, execute it with the customer's UUID and amount, then poll `/api/epay/transaction/status` until status is COMPLETE.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/api/epay/main/v2/form` | Initiate an eSewa hosted checkout redirect |
| GET | `/api/epay/transaction/status` | Check the final status of an eSewa transaction by UUID |

## Key resources

- **Payments** — Initiate a redirect-based eSewa checkout with HMAC-signed merchant fields
- **Transaction Status** — Look up the final status of any eSewa transaction by merchant UUID and product code

## Why Jentic

- **Setup:** Wiring eSewa ePay by hand means implementing its HMAC signature over the Authorization header, picking the right production or rc host, and verifying each transaction status yourself. Through Jentic you install once, import eSewa ePay from the API Directory, store the merchant secret key once, and your agent calls it.
- **Permission scoping:** eSewa ePay carries the payment target in the request body rather than the URL path, so scope the agent to the operations it needs, such as initiating a payment form or checking transaction status. You choose which operations are allowed, so nothing beyond initiate and verify runs unless you add it.
- **Credential handling:** Your eSewa merchant secret key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'accept an eSewa payment' or 'check eSewa transaction status', and Jentic returns the matching eSewa ePay operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Paystack API** — Paystack provides a similar redirect-and-verify checkout pattern but for African markets rather than Nepal.
- **PayU Latam API** — PayU Latam offers a comparable hosted-checkout model for Latin American buyers.
- **PayPal Orders API** — Pair PayPal Orders for international checkout alongside eSewa for the local Nepali wallet flow.

## FAQ

### Why is there no official OpenAPI spec for eSewa ePay API?

eSewa does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call eSewa ePay API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the eSewa ePay API use?

The eSewa ePay API uses an HMAC SHA256 signature derived from the merchant secret key, sent in the Authorization header. Through Jentic, the merchant secret is held encrypted in the vault and the agent only sees a scoped execution token, so the raw secret never enters the agent's prompt context.

### Can I issue refunds with the eSewa ePay API?

The two endpoints in this spec only cover initiating a payment and querying its status; refunds are not available as a programmatic operation in this API. The transaction status response will surface FULL_REFUND when a refund has been issued through eSewa's merchant dashboard, so you can detect refunds even though you cannot trigger them here.

### What are the rate limits for the eSewa ePay API?

eSewa does not document a public rate-limit policy for the ePay v2 endpoints. In practice, treat the form initiation endpoint as a per-checkout call and avoid polling the status endpoint more often than once every few seconds per transaction; back off on any non-2xx response.

### How do I verify a payment with the eSewa ePay API through Jentic?

Use the Jentic search query 'check eSewa transaction status'. Jentic returns the GET `/api/epay/transaction/status` operation with its input schema (product_code, transaction_uuid, total_amount). Load it, execute with the merchant UUID, and the agent receives the parsed status response without handling the HMAC header directly.

### Is the eSewa ePay API free to use?

Access to the API is free for approved merchants but eSewa charges a percentage commission on each successful transaction; the exact rate is set in your merchant agreement. Sandbox testing on rc-epay.esewa.com.np with the EPAYTEST merchant code does not incur fees.

### Can I limit what my agent is allowed to do with the eSewa ePay API?

Yes. Because you run Jentic One yourself, your own rules decide which eSewa operations the agent may call and which credentials it may use. The eSewa ePay API exposes just two operations, initiating a payment form (POST `/api/epay/main/v2/form`) and checking transaction status (GET `/api/epay/transaction/status`), and you choose which of them the agent is allowed to run. Since the payment target travels in the request body rather than the URL, nothing beyond the operations you explicitly permit will run, so you can grant status checks alone or add payment initiation only when needed.
