Skip to content

Command-line tool

Install the package first: see Node SDK.

The package installs a ctpeway command.

Terminal window
export CTPEWAY_API_KEY=ctp_test_sk_...
npx ctpeway invoices create --price 49.99 --accept USDT:bsc --accept ETH:ethereum --order-id order-1042
npx ctpeway invoices create --price 49.99 --customer-email ada@example.com # every enabled asset
npx ctpeway invoices create --amount 25000000 --asset USDT --network tron
npx ctpeway invoices list --status paid,underpaid --limit 20
npx ctpeway invoices list --search ada@example.com
npx ctpeway invoices get <invoice id>
npx ctpeway deposit-addresses create --name "Customer 42" --family evm
npx ctpeway deposit-addresses list --network bsc
npx ctpeway payments list --invoice <invoice id>
npx ctpeway balances
npx ctpeway balances bsc
npx ctpeway simulate invoice <invoice id> --outcome paid --settlement held
npx ctpeway simulate invoice <invoice id> --asset USDT --network bsc-testnet --stage detected
npx ctpeway simulate add-confirmation <payment id>
npx ctpeway simulate confirm <payment id> --settlement released
npx ctpeway simulate deposit-address <deposit address id> --asset USDT --inferred
npx ctpeway simulate attach-transaction <payment id>
npx ctpeway simulate deposit-address <deposit address id> --asset USDT --amount 5000000
export CTPEWAY_WEBHOOK_SECRET=whsec_...
npx ctpeway webhooks verify --payload event.json --signature "t=1791000000,v1=..."
  • Output is text by default; --json prints the API’s JSON for scripts (... --json | jq .id). --all follows every page of a list.
  • The key is read from CTPEWAY_API_KEY, or from --api-key. Prefer the environment variable: a flag ends up in shell history and process lists. --base-url or CTPEWAY_BASE_URL points the tool at a local API.
  • Amounts are base units, as in the library: --amount 25000000, not 25. --price is in US dollars.
  • Exit codes: 0 success, 1 the API or the verification said no, 2 the command was wrong.
  • The tool never prints the API key or a webhook secret, including in errors.
  • webhooks verify checks a payload saved to a file, byte for byte (an editor that adds a final newline changes the bytes). For an old capture add --skip-timestamp-check.

ctpeway --help lists every command and flag.