Product

Payments

Start payment integration free of charge through hosted checkout, Khalti and eSewa provider abstraction, callback verification, and failed payment recovery.

Provider Health

Real-time monitoring of payment provider availability and performance.

Khalti
healthy
Uptime

99.9%

Latency

120ms

eSewa
healthy
Uptime

99.7%

Latency

145ms

Provider Abstraction

GPSEWA backend handles all provider communication. Your frontend never calls Khalti/eSewa directly.

Payment Flow

End-to-end payment lifecycle from checkout creation to webhook delivery.

Checkout session created

10:00:00

Your server calls GPSEWA API

Customer redirected to provider

10:00:05

Khalti/eSewa payment page

Customer completes payment

10:00:45

Provider processes transaction

Provider callback received

10:00:46

GPSEWA backend receives callback

Payment verified

10:00:47

GPSEWA verifies with provider API

Webhook delivered

payment.paid event sent to your server

Create Checkout Session

POST /v1/checkout/sessions

Request bodyJSON
{
  "amount": 2500,
  "currency": "NPR",
  "provider_preference": "auto",
  "success_url": "https://merchant.example/success",
  "cancel_url": "https://merchant.example/cancel",
  "metadata": {
    "order_id": "ORD-1042",
    "customer_id": "CUS-8821"
  }
}

The checkout session is created server-side using your secret API key (sk_test_xxx). Never expose API keys in frontend code.

Hosted Checkout

Customer-safe checkout experience with provider selection and payment completion.

Checkout Preview
Customer sees this on the hosted checkout page

Pay to

Example Merchant

NPR 2,500

Order #ORD-1042

K
Khalti
e
eSewa
Callback Verification

When a customer completes payment, the provider sends a callback to GPSEWA backend.

GPSEWA receives provider callback
Verifies with provider API (not just callback data)
Normalizes response to GPSEWA payment object
Delivers signed webhook to your server
Failed Payment Recovery

Automatic handling of failed or abandoned payments.

Expired sessions trigger checkout.expired webhook
Failed payments include provider error codes
Configurable session expiration (default: 30 min)

Payment Status

Example payment records with various statuses.

Payment IDAmountProviderStatusCreated
pay_abc123NPR 2,500Khaltipaid2 min ago
pay_def456NPR 1,200eSewaprocessing5 min ago
pay_ghi789NPR 5,000Khaltipending8 min ago
pay_jkl012NPR 800eSewafailed15 min ago
pay_mno345NPR 3,200Khaltirequires review20 min ago
pay_pqr678NPR 1,500Khaltirefunded1 hour ago
Statuses:pendingprocessingpaidfailedexpiredrefundedrequires_review

Webhook Events

Real-time notifications for payment lifecycle events.

payment.paid
Payment successfully verified
payment.failed
Payment attempt failed
checkout.expired
Checkout session expired
refund.requested
Refund workflow started
refund.completed
Refund successfully processed

Webhook Security

Always verify GPSEWA webhook signatures on your server before fulfilling orders. Each webhook includes a signature header (gpsewa-signature) signed with your webhook secret (whsec_xxx).

Verification example

const signature = req.headers['gpsewa-signature'];
const isValid = gpsewa.webhooks.verify(
  req.body,
  signature,
  process.env.GPSEWA_WEBHOOK_SECRET
);

Start accepting payments

Sign up and integrate Khalti and eSewa-ready payments through GPSEWA free of charge.