Keep your order amount in your database. The browser should send an order ID, not the amount to charge.
1. Get your API keys
Sign up at dashboard.paybridgenp.com and copy your API key from Settings → API Keys.- Sandbox keys start with
sk_test_- use these for testing - Live keys start with
sk_live_- use these for real payments
2. Install the SDK
3. Create a checkout session
Call this from your server when a customer is ready to pay.checkout_url. They’ll see the PayBridgeNP hosted checkout page and can pay with any provider you’ve configured.
cancelUrl is optional. If you omit it, cancellations fall back to your
returnUrl with ?status=cancelled appended - and the hosted picker hides
its “Cancel” link. Set cancelUrl only if you want a dedicated cancel page
and a visible Cancel link on the picker.4. Handle the return redirect
After the customer pays (or cancels), they’re redirected to yourreturnUrl (or cancelUrl if set and the customer cancelled) with query parameters:
expired means the customer never finished and the session timed out. Treat it
the same as failed for fulfilment purposes: no money moved. Branch on
success and treat everything else as not-paid, rather than listing the
failure values, so a future status can never be read as a payment.
5. Verify payment server-side
session_id from the redirect? Fetch the session - once it’s paid, the response includes paymentId:
6. Set up a webhook endpoint
Go to Webhooks in the dashboard, click Add endpoint, enter your URL, and select the events you want to receive. Save the signing secret - it’s shown only once. See the webhook verification guide for full details on signature verification.Next steps
Sandbox Testing
Test the full flow with built-in test credentials before going live.
Provider Setup
Add your real eSewa, Khalti, and Fonepay credentials.
Idempotency
Make retries safe - avoid duplicate payments on network failures.
Billing
Set up recurring subscriptions and automated invoicing.