Payment buttons are embeddable checkout widgets that let customers pay directly from your website. You configure everything in the dashboard and embed a singleDocumentation Index
Fetch the complete documentation index at: https://docs.paybridgenp.com/llms.txt
Use this file to discover all available pages before exploring further.
<script> tag - the button fetches its settings live from PayBridgeNP, so changes you make in the dashboard take effect on the next page load without re-embedding.
Use cases
- E-commerce - add a Buy Now button to a product page
- Donations - accept fixed or custom-amount contributions
- SaaS - quick one-time payments from a landing page
- Invoicing - embed a Pay button in an email template or hosted invoice
How it works
Create a button in the dashboard
Configure the label, amount, color, customer fields, and return URL.
Paste it on your site
The script loads the button, which fetches its latest config from the API automatically.
Creating a button
- Go to Buttons in the dashboard
- Click New button
- Configure the button:
| Field | Required | Description |
|---|---|---|
| Internal name | Yes | For your reference only - not shown to customers |
| Button label | Yes | Text displayed on the button (e.g. “Pay Now”, “Donate”, “Buy”) |
| Color | No | Hex color for the button background (default: #5C2D91) |
| Amount | Yes | Fixed amount in NPR, or “Customer enters amount” for open-amount |
| Description | No | Shown on the checkout page |
| Return URL | Yes | Where the customer is redirected after payment |
| Cancel URL | No | Where the customer is redirected if they cancel |
| Provider | No | Pre-select a payment provider (eSewa, Khalti, or Fonepay) - or let the customer choose |
| Collect name | No | Show a “Full name” field before checkout |
| Collect email | No | Show an “Email address” field before checkout |
| Collect phone | No | Show a “Phone number” field before checkout |
- Click Create button - you will see an embed snippet.
Embedding the button
Copy the snippet and paste it anywhere inside your page’s<body>:
Multiple buttons on one page
You can embed multiple buttons on the same page. Each script tag renders independently:Inline overrides
In rare cases, you may want the same button to behave differently on different pages (e.g. different amounts for different products). You can override settings withdata-* attributes on the script tag:
| Attribute | Description |
|---|---|
data-amount | Override the amount (in paisa, e.g. 150000 = NPR 1,500.00) |
data-label | Override the button label text |
data-color | Override the button color (hex, e.g. #1e00ff) |
data-collect-name | Override collect name setting ("true" or "false") |
data-collect-email | Override collect email setting ("true" or "false") |
data-collect-phone | Override collect phone setting ("true" or "false") |
Customer experience
When a customer clicks the button:- A secure modal opens with the PayBridgeNP branding and the button’s color
- If collect fields are enabled, the customer fills in their name, email, or phone
- For custom-amount buttons, the customer enters the amount in NPR
- The customer clicks the pay button inside the modal
- A checkout session is created and the customer is redirected to the selected payment provider
- After payment, the customer is redirected to your return URL with
session_id,status, andpayment_idquery parameters
Return URL parameters
After payment, your return URL receives these query parameters:| Parameter | Description |
|---|---|
session_id | The checkout session ID |
status | success or failed |
payment_id | The payment ID (only present on success) |
Validation
The payment button validates customer input before submitting:| Field | Validation |
|---|---|
| Full name | At least 2 characters |
Valid email format (e.g. user@example.com) | |
| Phone | 7-15 digits, optional + prefix |
| Amount (custom) | Positive number in NPR |
Webhooks
Payment button transactions fire the same webhooks as API-created checkout sessions. The webhook payload includes thepayment_button_id field in the checkout session data.
Set up a webhook endpoint in the dashboard to receive payment.succeeded events. See Webhook verification for details.
Managing buttons
Enable / disable
Toggle a button on or off from the dashboard table. Disabled buttons are invisible - the script tag renders nothing on your page, so visitors see a blank space instead of a broken button.Editing
Click the edit icon on any button to change its settings. Since the button fetches config live, changes take effect on the next page load. No action is needed on your website.Deleting
Deleting a button is permanent. Any pages still using its embed snippet will render nothing.Stats
The dashboard table shows per-button stats:| Column | Description |
|---|---|
| Payments | Number of successful payments through this button |
| Volume | Total NPR amount collected through this button |
Sandbox testing
Payment buttons respect the mode of the project they belong to. Buttons on a sandbox project will use sandbox credentials and test payment flows. Buttons on a live project will process real payments. See Sandbox testing for provider-specific test credentials.Limitations
- Payment buttons are created and managed from the dashboard only - there is no API to create them programmatically
- Each project can have up to 200 buttons
- The button script requires JavaScript to be enabled in the customer’s browser
- The button renders as an inline-block element with a max width of 340px
- Custom CSS cannot be applied to the button (styling is self-contained to prevent conflicts with your site)