Test mode and going live

Every workspace has two separate environments. Build against Test with the Sandbox gateway and your providers' test credentials, then move to Live with new keys and a small real payment.

  • Test mode is free
  • Sandbox payments never move money
Same code, two keys
# .env on your test or staging server
PAYMENTSNP_API_KEY=np_test_...
PAYMENTSNP_WEBHOOK_SECRET=whsec_...   # from a Test endpoint
# .env on your production server
PAYMENTSNP_API_KEY=np_live_...
PAYMENTSNP_WEBHOOK_SECRET=whsec_...   # from a Live endpoint
The key's prefix picks the environment. Your code does not change.

Test and Live are separate

Switch between Test and Live in the dashboard topbar. Your team is the same in both, but everything you integrate with is kept apart.

What each environment keeps separately
ItemTestLive
API keysnp_test_…np_live_…
DataTest checkouts, payments, customers and invoicesLive records only
Payment methodsSandbox plus provider test credentials, each switched on separatelyLive provider credentials, each switched on separately
Webhook endpointsReceive test events onlyReceive live events only
Embed domainsUp to 20 for popup checkoutUp to 20 for popup checkout

A test key asking for live data gets 403 environment_mismatch, and the other way round. Invoice numbers and reconciliation records are counted separately per environment too.

The Sandbox gateway

Sandbox is a test-only payment method you connect under Gateways. At checkout it lets you choose the outcome, so you can test both branches of your code without a provider account.

OutcomesSimulates a success or a failure
MoneyNever moves money
WebhooksSends the same events as a real payment, with is_simulated: true
AvailabilityTest mode only. The production server refuses to start with it switched on.
CostFree

Provider test hosts

You can also save each provider's test credentials in Test. In Test, Paymentsnp sends those payments to the provider's own test host, so the redirects, signatures and checks match what happens in Live. Credentials come from each provider, under your own merchant agreement.

Where test payments go
MethodTest host used in TestHow it is checked
eSewarc-epay.esewa.com.np and uat.esewa.com.npSigned callback plus a status lookup for the exact amount
Khaltidev.khalti.com and test-pay.khalti.comLookup for the exact amount
Fonepaydev-clientapi.fonepay.comSigned return for the exact amount

When you save credentials, Paymentsnp checks them with the provider first and stores nothing if the provider rejects them. Saving credentials does not switch a method on; you enable it separately. Khalti is left out of checkout for amounts below NPR 10.

Switching to Live

Switching the dashboard from Test to Live asks you to confirm first, because Live means real money and real emails and SMS to your customers.

Your server picks its environment from the key it uses, not from the dashboard switch. Moving your integration to Live means swapping the np_test_ key for an np_live_ key and the test webhook secret for the live one.

Account approval

You verify your email address when you register. New accounts are then approved by the Paymentsnp team by default before you can sign in. Business details such as your registration number and PAN are optional at sign-up and are shown to the team reviewing your account.

Approval opens your workspace. Taking live payments also needs your own merchant account with each provider you want to offer.

Go-live checklist

  1. Approved account. Your Paymentsnp account is approved and your email verified.
  2. Provider testing for your credentials. Each provider you offer has accepted your merchant account, and you have run its test or UAT flow with your own credentials.
  3. Live credentials. In Live, save each provider's live credentials and switch the methods on.
  4. Live keys. Create an np_live_ key with only the scopes you need, and consider an IP allowlist and an expiry.
  5. Webhook endpoint. Add your live HTTPS endpoint, store its whsec_ secret, and send a test event.
  6. Allowed origins. Add your production site to allowed origins, and to embed domains if you use the popup.
  7. A small real payment. Pay a small amount end to end and check it under Payments and at your webhook.

After launch

  • Unresolved eSewa and Khalti attempts are re-checked in the background with backoff, so a late success is still recorded.
  • The Checkouts page shows payments still processing, with a button to check one now.
  • Import your provider settlement files to match verified payments with what was settled. See reconciliation.
  • Roll keys with a grace period when people or servers change. See key controls.