Create a checkout session
Creates a new checkout session and returns a checkout_url to redirect your customer to.
The customer picks their preferred payment provider on the hosted page (or you pre-select one via provider). PayBridgeNP notifies your returnUrl after the payment completes or fails.
Flow modes (set via flow):
hosted(default) - render the PayBridgeNP picker. Ifprovideris set, that option is pre-selected, but the customer can still switch.redirect- skip the picker and 302 the customer straight to the chosen provider. Requiresprovider. On cancellation at the provider, the customer is sent to yourcancelUrl(orreturnUrl?status=cancelledif nocancelUrlis set).
Cancel handling: cancelUrl is optional. When omitted, cancellations fall back to returnUrl with ?session_id=...&status=cancelled appended. The hosted picker only renders a “Cancel” link when cancelUrl is explicitly provided.
Idempotency: Pass an Idempotency-Key header to safely retry failed requests without creating duplicate sessions. The key is scoped to your project and expires after 24 hours.
Authorizations
Your PayBridgeNP API key. Obtain one from the dashboard under Settings → API Keys. Prefix: sk_test_ for testing, sk_live_ for production.
Headers
A unique string (UUID recommended) to make this request idempotent. Safe to retry on network failures.
Body
Payment amount in paisa. Must be an integer between 1,000 (Rs. 10) and 100,000,000 (Rs. 1,000,000). eSewa, Khalti, and Fonepay reject anything below Rs. 10.
1000 <= x <= 10000000010000
Your page URL. The customer is redirected here after payment (success or failure).
"https://yourapp.com/checkout/complete"
Must be NPR. Other currencies are not yet supported.
NPR Where the customer lands when they cancel - both at the provider and via the "Cancel" link on the hosted picker. Optional. When omitted, cancellations fall back to returnUrl with ?session_id=...&status=cancelled appended, and the hosted picker hides its Cancel link entirely.
"https://yourapp.com/checkout/cancelled"
Opt this session into Embedded Checkout: render the payment overlay on your own page (cart totals, your own checkout page) instead of redirecting. Must be an origin already registered under Project -> Embed domains for this mode, or the request fails with a 400 so you find out at create time. Requires a Growth plan or higher, and flow must be hosted. The session's checkout URL then renders inside the overlay on that origin; after the provider round-trip the customer returns to your returnUrl with session_id, status and (on success) payment_id appended - render your confirmation from those, or fetch the session. When the customer is offered a PayBridgeNP ID save prompt, they see our hosted success page first and continue to your returnUrl from there. (The automatic overlay reopen on return belongs to payment-button sessions, whose script on your page carries the state to do it.)
"https://yourshop.com"
Pre-select a provider. Omit to let the customer choose on the hosted page. Required when flow is redirect.
esewa, khalti, fonepay hosted (default) renders the PayBridgeNP picker (provider pre-selected if set). redirect skips the picker and forwards straight to the provider - requires provider.
hosted, redirect Human-readable purchase description (max 200 chars). Providers that support it - like Khalti's purchase_order_name - surface this on their hosted checkout page. Falls back to a generic placeholder when omitted.
200"Order #1001"
Arbitrary key-value data (max 8 KB). Returned on the payment object and in webhook payloads.
Optional customer details pre-filled on the checkout page.
When true, the hosted checkout page asks the customer for a shipping address (street and city required) before payment. The collected address is included as customer_address in webhook event payloads - null otherwise.
Response
Checkout session created.
"cs_01j9x2k3m4n5p6q7r8s9t0u1v2"
true when created with a live key, false for sandbox.
Redirect your customer to this URL to complete payment.
"https://checkout.paybridgenp.com/checkout/cs_01j9x2k3m4n5p6q7r8s9t0u1v2"
Echoes the requested flow. Defaults to hosted when omitted on creation.
hosted, redirect Pre-selected provider, or null if the customer will pick on the hosted page.
esewa, khalti, fonepay