Skip to main content
POST
curl

Authorizations

Authorization
string
header
required

Your PayBridgeNP API key. Obtain one from the dashboard under Settings → API Keys. Prefix: sk_test_ for testing, sk_live_ for production.

Headers

Idempotency-Key
string

A unique string (UUID recommended) to make this request idempotent. Safe to retry on network failures.

Body

application/json
amount
integer
required

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.

Required range: 1000 <= x <= 100000000
Example:

10000

returnUrl
string<uri>
required

Your page URL. The customer is redirected here after payment (success or failure).

Example:

"https://yourapp.com/checkout/complete"

currency
enum<string>
default:NPR

Must be NPR. Other currencies are not yet supported.

Available options:
NPR
cancelUrl
string<uri> | null

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.

Example:

"https://yourapp.com/checkout/cancelled"

embedOrigin
string<uri> | null

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.)

Example:

"https://yourshop.com"

provider
enum<string>

Pre-select a provider. Omit to let the customer choose on the hosted page. Required when flow is redirect.

Available options:
esewa,
khalti,
fonepay
flow
enum<string>
default:hosted

hosted (default) renders the PayBridgeNP picker (provider pre-selected if set). redirect skips the picker and forwards straight to the provider - requires provider.

Available options:
hosted,
redirect
description
string | null

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.

Maximum string length: 200
Example:

"Order #1001"

metadata
object | null

Arbitrary key-value data (max 8 KB). Returned on the payment object and in webhook payloads.

Example:
customer
object | null

Optional customer details pre-filled on the checkout page.

collectAddress
boolean
default:false

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.

id
string
Example:

"cs_01j9x2k3m4n5p6q7r8s9t0u1v2"

livemode
boolean

true when created with a live key, false for sandbox.

checkout_url
string<uri>

Redirect your customer to this URL to complete payment.

Example:

"https://checkout.paybridgenp.com/checkout/cs_01j9x2k3m4n5p6q7r8s9t0u1v2"

flow
enum<string>

Echoes the requested flow. Defaults to hosted when omitted on creation.

Available options:
hosted,
redirect
provider
enum<string> | null

Pre-selected provider, or null if the customer will pick on the hosted page.

Available options:
esewa,
khalti,
fonepay
expires_at
string<date-time>