Skip to main content
The HitPay CLI brings the payment gateway to your terminal. Create payment requests, list charges, generate QR codes, and test webhooks end-to-end without leaving your shell — ideal for integrating HitPay into scripts, CI pipelines, and local development workflows.

What’s Included

Account & Payments

Manage payment requests, charges, refunds, customers, invoices, subscriptions, beneficiaries, and transfers with a consistent hitpay <resource> <action> syntax.

Webhook Testing

hitpay listen tunnels your local server to the public internet and auto-registers a webhook endpoint. hitpay trigger simulates real events — no need to wait for live traffic.

QR Codes in Terminal

hitpay qr create renders scannable QR codes directly in your terminal for PayNow, QRIS, PromptPay, GCash, DuitNow, and 50+ other methods across Southeast Asia.

Installation

1

Install the CLI

Install globally with npm:
npm install -g @hit-pay/cli
Or run without installing:
npx @hit-pay/cli --help
Requires Node.js 18 or later.
2

Log in

Interactive login (prompts for API key):
hitpay login
Or provide the key directly for non-interactive environments like CI:
hitpay login --api-key sk-live-xxxxxxxxxxxx
Get your API key from Dashboard → Settings → Payment Gateway → API Keys.
3

Verify

Check you’re logged in and on the right environment:
hitpay whoami
Then run any command. For example, list recent charges:
hitpay charge list
The CLI is in Beta (v0.1.0). If npm install -g @hit-pay/cli fails with a 404, install from source until the first npm publish:
git clone https://github.com/hit-pay/cli.git
cd cli && npm install && npm run build && npm link

Authentication & Config

Credentials are stored locally at ~/.hitpay/config.json with 0600 permissions. Inspect or update them with the config command:
hitpay config list
hitpay config set environment sandbox
hitpay config get currency

Environment variables

Override any stored config with env vars — useful for CI:
VariableDescription
HITPAY_API_KEYAPI key; overrides ~/.hitpay/config.json
HITPAY_ENVIRONMENTsandbox or production

Global flags

Available on every command:
FlagDescription
--env <environment>One-shot environment override (e.g. --env production)
--jsonOutput raw JSON for piping to jq, scripts, or CI
--helpShow command help
--versionPrint CLI version
The CLI defaults to sandbox. Run hitpay config set environment production (or pass --env production) only when you are ready to move real money.

Commands

CategoryCommands
Accountlogin, logout, whoami, config set/get/list
Payment Requestspayment create, payment get, payment list, payment cancel
Chargescharge list, charge get, charge export
Refundsrefund
Customerscustomer create/list/get/update/delete
Invoicesinvoice create/list/delete
Subscriptionsplan create/list/get/delete, subscription create/list/get/cancel
Payoutsbeneficiary create/list/delete, transfer estimate/create/list/get
QR Codesqr create, methods
Webhooks (dev)listen, trigger
Run hitpay <command> --help for full argument details on any command.

Webhook development flow

The CLI’s webhook tooling is the fastest way to build and test webhook handlers locally — no ngrok setup, no manual endpoint registration.

Forward live events to localhost

hitpay listen --forward-to http://localhost:3000/api/webhooks
This opens a secure tunnel, registers a temporary webhook endpoint with HitPay, and forwards every event to your local server. When you press Ctrl+C, the endpoint is cleaned up automatically.

Simulate events without live traffic

hitpay trigger charge.created
hitpay trigger --list   # show all supported event types
trigger posts a signed payload to whichever endpoint listen is currently forwarding, so you can exercise your handler’s signature verification, idempotency, and event routing without waiting for a real payment.

Usage Examples

hitpay payment create \
  --amount 49.90 \
  --currency SGD \
  --email customer@example.com \
  --reference INV-2026-001
Returns the checkout URL and payment request ID. Add --json to parse the result in a script.

Prerequisites

  1. HitPay AccountCreate an account or use the sandbox environment
  2. API Key — Found in Settings → Payment Gateway → API Keys
  3. Node.js 18 or later — Check with node --version

Which AI developer tool should I use?

HitPay offers three developer tooling options. They complement each other — most teams use two or more.
ToolUse when you want to…
Claude Code PluginBuild payment integrations with Claude Code using live API access and auto-triggered skills
Agent SkillsGenerate HitPay integration code with Cursor, Copilot, Windsurf, or any AI assistant
CLI (this page)Drive the API from your terminal, scripts, and CI pipelines — especially for webhook testing

Resources

GitHub Repository

View source, report issues, and contribute

Claude Code Plugin

Live API access from inside Claude Code

Agent Skills

Skills for Cursor, Copilot, and Windsurf

API Reference

Full API documentation

Webhook Events

Handle payment notifications

Sandbox Guide

Test your integration

Feedback

Have suggestions or found an issue? Open an issue on GitHub.
Last modified on April 18, 2026