Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.paybridgenp.com/llms.txt

Use this file to discover all available pages before exploring further.

Installation

npm install -g @paybridge-np/cli
After installing, both paybridgenp and paybridge-np are available as aliases.
paybridgenp --version

Authentication

paybridgenp login

Authenticate with your API key. You can find your keys in the dashboard under Settings → API Keys.
paybridgenp login
The CLI prompts for your key interactively. For CI/scripts, pass it directly:
paybridgenp login --key sk_test_...
Or set the environment variable to skip login entirely:
export PAYBRIDGE_API_KEY=sk_test_...
The PAYBRIDGE_API_KEY environment variable always takes priority over the saved config. Config is stored at:
  • macOS/Linux: ~/.config/paybridgenp/config.json
  • Windows: %APPDATA%\paybridgenp\config.json
The file is written with 0600 permissions - readable only by you.

paybridgenp status

Show the current authentication state and API connection.
paybridgenp status
  PayBridgeNP CLI

  Key           sk_test_abc1...
  Mode          sandbox
  API           https://api.paybridgenp.com
  Source        config file (~/.config/paybridgenp/config.json)

Payments

paybridgenp payments list

List recent payments in a table.
paybridgenp payments list
paybridgenp payments list --limit 50
paybridgenp payments list --watch        # live-refresh every 5s
FlagDefaultDescription
--limit <n>20Number of results (max 100)
--watchoffPoll and redraw every 5 seconds

paybridgenp payments get <id>

Fetch a single payment with full detail.
paybridgenp payments get pay_abc123
  Payment pay_abc123

  Amount        NPR 500.00
  Status        success
  Provider      esewa
  Provider ref  1234567890
  Session       cs_abc123
  Created       16 Apr 2026, 12:34 NPT
  Metadata      { "order_id": "123" }

Webhooks

paybridgenp webhooks list

List all registered webhook endpoints for the current project.
paybridgenp webhooks list

paybridgenp webhooks listen

Start a local HTTP server and expose it via an ngrok tunnel. Use this during development to receive real webhook events on your machine.
paybridgenp webhooks listen
paybridgenp webhooks listen --port 4242 --secret whsec_...
  Webhook listener ready

  Local    http://localhost:4242
  Public   https://abc123.ngrok-free.app

  Add this URL to your PayBridgeNP dashboard → Webhooks → Add endpoint
  Listening for events... (Ctrl+C to stop)

  [12:34:56] payment.succeeded
             id:           pay_abc123
             amount:       NPR 100.00
             provider:     esewa
             provider_ref: TX123456
FlagDefaultDescription
--port <n>4242Local port to listen on
--secret <whsec_...>noneVerify incoming HMAC signatures
--forward <url>noneForward verified events to another local URL
ngrok must be installed. Install it with brew install ngrok or from ngrok.com.

paybridgenp webhooks test <url>

Send a fake signed event to any URL to test your webhook handler.
paybridgenp webhooks test https://yoursite.com/webhooks/paybridge
paybridgenp webhooks test http://localhost:4242 --secret whsec_... --event payment.failed
FlagDefaultDescription
--secret <whsec_...>noneSign the payload (recommended)
--event <type>payment.succeededEvent type to send
--amount <paisa>10000Amount in the payload
Supported event types:
EventDescription
payment.succeededSuccessful payment
payment.failedFailed payment attempt
payment.cancelledCustomer cancelled
payment.refundedRefund issued

Testing

paybridgenp test

Create a real sandbox checkout session and open it in the browser. Complete a test payment end-to-end without writing any code.
paybridgenp test
paybridgenp test --amount 50000    # NPR 500.00
paybridgenp test --no-open         # print URL only
  Checkout session created

  Session ID    cs_test_abc123
  Amount        NPR 10.00
  URL           https://checkout.paybridgenp.com/checkout/cs_test_abc123

  Sandbox test credentials

  eSewa         merchant code EPAYTEST
  Khalti        phone 9800000001 · PIN 1111 · OTP 987654
FlagDefaultDescription
--amount <paisa>1000Amount in paisa (NPR 10.00)
--no-openoffPrint URL without opening the browser
If you run paybridgenp test with a live key (sk_live_...), the CLI will warn you and require explicit confirmation before creating a real checkout.

Scaffolding

paybridgenp init

Interactively scaffold a starter project with working checkout and webhook routes.
paybridgenp init

# Non-interactive (for CI or scripts):
paybridgenp init --name my-shop --framework nextjs
FlagDescription
--name <name>Project directory name
--framework <framework>nextjs, node, or bare
What gets created:
my-shop/
  app/
    api/
      checkout/route.ts   ← POST /api/checkout
      webhook/route.ts    ← POST /api/webhook
  .env                    ← pre-filled with your API key
  .env.example
  .gitignore              ← .env added automatically
  package.json
my-shop/
  index.ts                ← HTTP server with /checkout + /webhook routes
  .env
  .env.example
  .gitignore
  package.json
my-shop/
  index.ts                ← minimal SDK usage example
  .env
  .env.example
  .gitignore
  package.json

Updates

paybridgenp update

Check if a newer version is available on npm.
paybridgenp update
  Checking for updates...

  Current       v0.1.1
  Latest        v0.1.1

  ✓ You're up to date

  $ npm install -g @paybridge-np/cli@latest

Global flags

These flags work with every command:
FlagDescription
--debugPrint full error stack traces instead of friendly messages
--versionPrint the CLI version
--helpShow help for any command
paybridgenp payments list --debug
paybridgenp webhooks listen --debug

Configuration reference

SourcePriorityHow to set
PAYBRIDGE_API_KEY env var1 (highest)export PAYBRIDGE_API_KEY=sk_...
Config file2Set by paybridgenp login