A payments API for Nepal that you can read in an afternoon.
One call creates a checkout for eSewa, Khalti and Fonepay. We handle each provider's signing, redirects and verification, then tell your server with a signed webhook.
Test mode with a Sandbox gateway is free. The full docs open after you sign in; the public guides below cover the essentials, starting with the quickstart.

Three jobs. One API for all of them.
Every integration does the same three things, in test and in live, whichever provider the customer picks.
Accept
Create a checkout on your server and send the customer to it.
Verify
Fulfil only on evidence from the provider, never on a redirect.
Reconcile
Match what was verified with what your provider settled.
- Your serverCreates a checkout with an order ID and amount
- CustomerPicks eSewa, Khalti or Fonepay and pays there
- ProviderTakes the payment into your own merchant account
- PaymentsnpVerifies the exact amount and signs a webhook
Create a checkout. Get a URL back.
Send an order ID and an amount in paisa with your secret key and an Idempotency-Key. Retrying with the same key returns the same checkout.
Follow the quickstartcurl -X POST https://api.paymentnp.com/v1/checkout/sessions \
-H "Authorization: Bearer $PAYMENTSNP_API_KEY" \
-H "Idempotency-Key: order-1001" \
-H "Content-Type: application/json" \
-d '{
"order_id": "order-1001",
"amount_minor": 150000,
"currency": "NPR",
"success_url": "https://shop.example.com/orders/1001",
"cancel_url": "https://shop.example.com/cart"
}'import { Paymentsnp } from "@paymentsnp/sdk";
const pnp = new Paymentsnp({ apiKey: process.env.PAYMENTSNP_API_KEY });
// NPR 1,500.00 = 150000 paisa
const session = await pnp.checkout.sessions.create(
{
order_id: "order-1001",
amount_minor: 150000,
currency: "NPR",
success_url: "https://shop.example.com/orders/1001",
cancel_url: "https://shop.example.com/cart",
},
{ idempotencyKey: "order-1001" },
);
// Redirect the customer to session.checkout_url<?php
$paymentsnp = new \Paymentsnp\PaymentsnpClient(getenv('PAYMENTSNP_API_KEY'));
// NPR 1,500.00 = 150000 paisa
$session = $paymentsnp->checkout->sessions->create([
'order_id' => 'order-1001',
'amount_minor' => 150000,
'currency' => 'NPR',
'success_url' => 'https://shop.example.com/orders/1001',
'cancel_url' => 'https://shop.example.com/cart',
], ['idempotency_key' => 'order-1001']);
header('Location: ' . $session['checkout_url']);import os
from paymentsnp import Paymentsnp
client = Paymentsnp(api_key=os.environ["PAYMENTSNP_API_KEY"])
# NPR 1,500.00 = 150000 paisa
session = client.checkout.sessions.create(
{
"order_id": "order-1001",
"amount_minor": 150000,
"currency": "NPR",
"success_url": "https://shop.example.com/orders/1001",
"cancel_url": "https://shop.example.com/cart",
},
idempotency_key="order-1001",
)
# Redirect the customer to session["checkout_url"]HTTP/1.1 201 Created
{
"id": "c1a94d07-…",
"order_id": "order-1001",
"status": "open",
"amount_minor": 150000,
"currency": "NPR",
"environment": "test",
"available_methods": ["esewa", "khalti", "fonepay"],
"expires_at": "2026-10-01T07:45:00.000Z",
"checkout_url": "https://paymentsnp.com/c/…",
"public_session_path": "/v1/checkout/public/…"
}The API at a glance. Small on purpose.
REST over HTTPS with JSON. Every key is either test or live and carries only the scopes you give it.
Read the API overview| Base URL | https://api.paymentnp.com/v1 |
|---|---|
| Auth | Bearer key, np_test_ or np_live_ |
| Amounts | Integer paisa in NPR. NPR 1,500.00 is 150000. |
| Retries | Idempotency-Key required on checkout creation |
| Errors | { error: { code, message, request_id } } |
| Reference | Swagger and /openapi.json |
- Idempotent checkout creation, safe to retry
- Webhooks signed with HMAC-SHA256, up to 8 delivery attempts, replayable
- Keys with scopes, expiry, rolling with a grace period, IP allowlists and per-key rate limits
- Test mode only sees test data; the Sandbox gateway simulates success and failure
- Unclear provider answers stay pending, never paid by guesswork
| Route | Method | Scope | What it does |
|---|---|---|---|
/v1/checkout/sessions | POST | checkout:create | Create a checkout. Needs Idempotency-Key. |
/v1/checkout/sessions/:id | GET | checkout:read | Read a session and its status. |
/v1/checkout/sessions/:id/expire | POST | checkout:create | Stop new payment attempts. |
/v1/payments | GET | payments:read | Verified payments, filterable by provider, search and dates. |
/v1/payments/:id | GET | payments:read | One payment with its provider transaction ID. |
/v1/payments/:id/refunds | POST | refunds:write | Record a refund made in the provider panel. |
/v1/invoices | GET | invoices:read | Invoices by status, with totals. |
/v1/invoices | POST | invoices:write | Create a draft invoice. |
/v1/invoices/:id/finalize | POST | invoices:write | Number a draft and open it for payment. |
/v1/invoices/:id/send | POST | invoices:write | Email the invoice and its link, and/or send an SMS notice (no link). |
/v1/reconciliation/import/bulk | POST | reconciliation:write | Import up to 500 settlement rows. |
/v1/reconciliation/report | GET | reconciliation:read | Verified payments against settlements, 7, 30 or 90 days. |
A webhook when it is paid. Signed, retried and replayable.
After the provider confirms the exact amount, Paymentsnp POSTs payment.succeeded to your HTTPS endpoint. The Paymentnp-Signature header carries a timestamp and an HMAC-SHA256 of the timestamp and raw body, made with your whsec_ secret.
Verify the signature, store the event ID and skip repeats, then fulfil the order once. Failed deliveries are retried with backoff, and you can replay any delivery from the dashboard.
POST /webhooks/paymentsnp HTTP/1.1
Content-Type: application/json
Paymentnp-Signature: t=1791100000,v1=5f2c…
Paymentnp-Event-Id: 8f4f7c0e-2b1d-4a7e-9c55-0d3e1f6a9b21
{
"id": "8f4f7c0e-2b1d-4a7e-9c55-0d3e1f6a9b21",
"type": "payment.succeeded",
"api_version": "v1",
"environment": "test",
"created_at": "2026-10-01T06:45:05.000Z",
"data": {
"payment_id": "5b2d6c1e-…",
"checkout_session_id": "c1a94d07-…",
"order_id": "order-1001",
"provider": "esewa",
"provider_transaction_id": "000AB12",
"amount_minor": 150000,
"currency": "NPR",
"is_simulated": false,
"overpaid": false
}
}SDKs, CLI and an MCP server. Zero runtime dependencies.
Official libraries with typed errors, retries and webhook verification. Method names match across languages, and field names are the API's own snake_case, so one reference covers all of them.
- TypeScript
npm i @paymentsnp/sdkNode 18+, Bun, Deno and edge runtimes. Includes the paymentsnp CLI. - PHP
composer require paymentsnp/paymentsnp-phpPHP 7.4+, curl and json only. Works without Composer. - Python
pip install paymentsnpPython 3.9+, standard library only. - MCP server
npx -y @paymentsnp/mcpFor Claude, Cursor and other MCP clients. Read-only unless you allow writes.
export PAYMENTSNP_API_KEY=np_test_...
# Create a checkout for NPR 1,500 (the CLI takes rupees)
paymentsnp checkout create --amount 1500.00 --order ORD-1 \
--success-url https://shop.example.com/thanks \
--cancel-url https://shop.example.com/cart
# Open checkout_url, pay with Sandbox, then check it
paymentsnp checkout get <session_id>Plugins if you would rather not write code. Download them from the dashboard.
Each one completes an order only after Paymentsnp verifies the payment. Sign in to download them; each has its own setup guide.
| Platform | What it does | Guide |
|---|---|---|
| WHMCS | Gateway module v3 pays WHMCS invoices with eSewa, Khalti and Fonepay, and upgrades v2 installs in place. | WHMCS module |
| WooCommerce | Adds Paymentsnp as a payment method, including the Checkout block and HPOS stores. | WooCommerce plugin |
| Shopify | A self-hosted app that sends customers a pay link and marks the order paid once verified. Shopify only lets approved partners inside its checkout, so it uses a manual payment method. | Shopify app |
| No website | Payment links take a payment with no code at all. | Payment links |
Docs map. Six public guides and the full reference.
- QuickstartAccept a first test payment in three steps.
- API overviewKeys, scopes, idempotency, errors, limits and every route.
- WebhooksSignatures, events, retries and verification code.
- SDKs and CLITypeScript, PHP and Python clients, the CLI and checkout.js.
- Test mode and going liveSandbox, provider test hosts and the go-live checklist.
- MCP serverAsk Claude, Cursor or another assistant about your payments.
- Full developer guideEvery endpoint, SDK method and integration in one place.
- API reference (Swagger)Generated from the API itself, with request and response schemas.
A redirect is not a receipt. Fulfil on evidence.
Your success_url tells you the customer came back. It does not tell you they paid. Fulfil on the webhook, or fetch the session.
- Money settles directly to your own eSewa, Khalti and Fonepay merchant accounts.
- Every payment is verified server-side with the provider, for the exact amount.
- API key secrets are shown once and stored only as a hash.
- More on how we handle money and data on the security page.