Skip to main content

CLI Tool

The openpay CLI lets you manage payments, webhooks, and configuration directly from your terminal.

Installation

go install github.com/openlankapay/openpay-cli@latest
Verify the installation:
openpay --version

Authentication

Log in with your API credentials. The CLI stores them locally in ~/.openpay/config.yaml.
openpay login
You will be prompted for your API key and secret:
Enter API Key: ak_live_abc123
Enter API Secret: ********
Authenticated successfully. Credentials saved to ~/.openpay/config.yaml
Alternatively, set credentials via environment variables:
export OPENPAY_API_KEY=ak_live_abc123
export OPENPAY_API_SECRET=sk_live_xyz789

Configuration

Manage CLI settings with openpay config:
# Set the API base URL
openpay config set api_url https://olp-api.nipuntheekshana.com

# Set default output format
openpay config set output json

# View current configuration
openpay config list
SettingDefaultDescription
api_urlhttps://olp-api.nipuntheekshana.comAPI base URL
outputtableOutput format: table, json, or yaml
api_key(none)Your API key
api_secret(none)Your API secret (stored securely)

Payments

List Payments

# List recent payments
openpay payments list

# Filter by status
openpay payments list --status completed

# Limit results
openpay payments list --limit 10 --page 1

# Output as JSON
openpay payments list --output json
Example output:
ID                  AMOUNT    CURRENCY  STATUS      CREATED
pay_8f3a1b2c...     50.00     USD       completed   2026-03-25T10:30:00Z
pay_9d4e2f3a...     25.00     USD       pending     2026-03-25T11:15:00Z
pay_1a5b3c4d...     100.00    USD       expired     2026-03-24T09:00:00Z

Create a Payment

openpay payments create \
  --amount 50.00 \
  --currency USD \
  --description "Invoice #1234"
Output:
Payment created successfully.

ID:             pay_8f3a1b2c4d5e6f7a
Amount:         50.00 USD
Status:         pending
Wallet:         0x1234...abcd
Expires:        2026-03-26T11:00:00Z

Get Payment Details

openpay payments get pay_8f3a1b2c4d5e6f7a

Webhooks

Configure a Webhook

openpay webhooks configure \
  --url https://yoursite.com/api/webhooks/openpay \
  --events payment.completed,payment.failed,payment.expired

List Webhook Deliveries

openpay webhooks deliveries --limit 20

Test a Webhook

Send a test event to your configured endpoint:
openpay webhooks test --event payment.completed

Checkout Sessions

Create a Checkout Session

openpay checkout create \
  --amount 25.00 \
  --currency USD \
  --description "Premium Plan" \
  --success-url https://yoursite.com/success \
  --cancel-url https://yoursite.com/cancel
Output:
Checkout session created.

Session ID:     cs_abc123def456
Checkout URL:   https://olp-api.nipuntheekshana.com/checkout/cs_abc123def456
Payment ID:     pay_8f3a1b2c4d5e6f7a
Expires:        2026-03-26T11:30:00Z

Global Flags

These flags work with any command:
FlagShortDescription
--output-oOutput format: table, json, yaml
--verbose-vEnable verbose logging
--help-hShow help for any command
--versionShow CLI version

Shell Completion

Generate shell completion scripts:
openpay completion bash > /etc/bash_completion.d/openpay