CLI overview

The Plugipay CLI is a Node.js command-line tool for everything you can do in the portal — querying payments, managing customers, configuring webhooks — from your terminal. It's particularly useful for:

  • Scripting one-off operations (refund a batch, export a CSV)
  • CI/CD integration (provision API keys, run migrations)
  • Quick exploration ("what's the fee on this payment?")
  • Automating reconciliation

Everything below assumes you've installed the CLI and authenticated.

What it can do

plugipay --help

Top-level command groups:

Group What it does
auth Login, logout, whoami
customers Create, list, get, update, delete
payments List, get, capture, cancel
checkout Create checkout sessions
refunds Issue refunds
subscriptions Manage subscriptions and plans
invoices List, get, send
templates Manage checkout-page templates
webhooks Add, remove, test endpoints
api-keys Create, list, revoke
workspaces Switch active workspace
account View profile, change settings

Each group has subcommands. Run plugipay <group> --help to see them.

Conventions

Three conventions across every command:

1. Read from env, override with flags

Credentials and base URLs come from environment variables by default, and you can override them per-call with flags:

# Uses PLUGIPAY_KEY_ID and PLUGIPAY_KEY_SECRET from env
plugipay payments list

# Override for one command
plugipay payments list --key-id=pk_test_xxx --key-secret=sk_test_xxx

# Use a different base URL (e.g., staging)
plugipay payments list --base-url=https://api-staging.plugipay.com

2. Output formats

Every list and get command supports --output (alias -o):

plugipay payments list -o json   # default for machine consumption
plugipay payments list -o table  # human-readable table
plugipay payments list -o csv    # CSV for spreadsheets
plugipay payments list -o ids    # just IDs, one per line

Pipe to jq, awk, or xargs for further processing:

# Refund every payment from the last hour
plugipay payments list --since 1h -o ids | xargs -n1 plugipay refunds create --payment-id

3. Profiles

Multiple workspaces? Use profiles:

plugipay configure --profile work
plugipay configure --profile personal

plugipay --profile work payments list
plugipay --profile personal payments list

Profiles are stored in ~/.plugipay/credentials (INI format). See Configuration for details.

Quick examples

List today's successful payments

plugipay payments list --status succeeded --since 1d

Refund a specific payment

plugipay refunds create --payment-id pay_01HXXX --reason requested_by_customer

Create a checkout session and copy the URL

plugipay checkout create \
  --amount 250000 \
  --currency IDR \
  --description "Pro upgrade" \
  --success-url https://example.com/success \
  --cancel-url https://example.com/cancel \
  -o json | jq -r '.url'

Export this month's payments to CSV

plugipay payments list --since 30d -o csv > payments-this-month.csv

Rotate an API key

plugipay api-keys revoke --key-id pk_live_old_xxx
plugipay api-keys create --name "Server (post-rotation)" --role full_access

Test a webhook endpoint locally

# In one terminal: forward webhooks to your local dev server
plugipay webhooks listen --forward-to http://localhost:3000/webhooks

# In another: trigger a test event
plugipay webhooks trigger --event payment.succeeded

Every page

Next

Plugipay — Payments that don't tax your success