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.

A smiling developer at a desk with a laptop and a monitor full of code

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.

  1. Your serverCreates a checkout with an order ID and amount
  2. CustomerPicks eSewa, Khalti or Fonepay and pays there
  3. ProviderTakes the payment into your own merchant account
  4. PaymentsnpVerifies the exact amount and signs a webhook
Money moves from the customer to your provider account. Paymentsnp checks it and tells you; it never holds funds.

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 quickstart
curl -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"]
Server-side only. Keep your secret key out of browser code.
Response
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/…"
}
checkout_url is valid for one hour.

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 URLhttps://api.paymentnp.com/v1
AuthBearer key, np_test_ or np_live_
AmountsInteger paisa in NPR. NPR 1,500.00 is 150000.
RetriesIdempotency-Key required on checkout creation
Errors{ error: { code, message, request_id } }
ReferenceSwagger 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
Core API-key routes and the scope each needs
RouteMethodScopeWhat it does
/v1/checkout/sessionsPOSTcheckout:createCreate a checkout. Needs Idempotency-Key.
/v1/checkout/sessions/:idGETcheckout:readRead a session and its status.
/v1/checkout/sessions/:id/expirePOSTcheckout:createStop new payment attempts.
/v1/paymentsGETpayments:readVerified payments, filterable by provider, search and dates.
/v1/payments/:idGETpayments:readOne payment with its provider transaction ID.
/v1/payments/:id/refundsPOSTrefunds:writeRecord a refund made in the provider panel.
/v1/invoicesGETinvoices:readInvoices by status, with totals.
/v1/invoicesPOSTinvoices:writeCreate a draft invoice.
/v1/invoices/:id/finalizePOSTinvoices:writeNumber a draft and open it for payment.
/v1/invoices/:id/sendPOSTinvoices:writeEmail the invoice and its link, and/or send an SMS notice (no link).
/v1/reconciliation/import/bulkPOSTreconciliation:writeImport up to 500 settlement rows.
/v1/reconciliation/reportGETreconciliation:readVerified 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.

Webhooks guide with verification code

payment.succeeded
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
  }
}
Abridged. Every delivery carries the same envelope.

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.

  • TypeScriptnpm i @paymentsnp/sdkNode 18+, Bun, Deno and edge runtimes. Includes the paymentsnp CLI.
  • PHPcomposer require paymentsnp/paymentsnp-phpPHP 7.4+, curl and json only. Works without Composer.
  • Pythonpip install paymentsnpPython 3.9+, standard library only.
  • MCP servernpx -y @paymentsnp/mcpFor Claude, Cursor and other MCP clients. Read-only unless you allow writes.
paymentsnp CLI
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>
Installed with @paymentsnp/sdk. It reads the key from the environment.

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.

Plugins and no-code options
PlatformWhat it doesGuide
WHMCSGateway module v3 pays WHMCS invoices with eSewa, Khalti and Fonepay, and upgrades v2 installs in place.WHMCS module
WooCommerceAdds Paymentsnp as a payment method, including the Checkout block and HPOS stores.WooCommerce plugin
ShopifyA 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 websitePayment links take a payment with no code at all.Payment links

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.