Skip to main content
clink-cli is a command-line client for Clink customer wallet APIs. Use it to initialize customer wallet profiles, open card setup or management pages, make payments, create refunds, and inspect risk rule settings.
Security Note: The CLI can store customer credentials in your local profile. Do not commit ~/.clink-cli/config.json or share values such as customer-api-key.

NPM Package

View the package on npmjs.com

Requirements

  • Node.js >=20
  • Access to the target Clink API environment
The default base URL is:
https://api.clinkbill.com

Installation

Install the CLI globally:
npm install -g @clink-ai/clink-cli
Or run it without a global install:
npx clink-cli --help
Every command starts with:
clink-cli <command> [subcommand] [options]

Quick Start

1. Initialize your wallet

Run this once to create or activate a customer wallet and save credentials locally:
clink-cli wallet init --email user@example.com --name "Alice"
Check the saved profile:
clink-cli wallet status --format pretty
The local config file is stored at:
~/.clink-cli/config.json

2. Open card pages

Get the raw binding link:
clink-cli card binding-link
Open the add-card page:
clink-cli card setup-link --open
Open the manage-card page:
clink-cli card modify-link --open

3. Check saved payment methods

List cached payment methods:
clink-cli card list --format pretty
Get one cached payment method:
clink-cli card get --payment-instrument-id pi_xxx
Notes:
  • Card add, update, and delete actions happen on the web page, not directly in the CLI.
  • card list and card get read local cached data.
  • card binding-link, card setup-link, and card modify-link refresh the local payment method cache.

4. Make a payment

Pay with merchant mode:
clink-cli pay \
  --merchant-id merchant_xxx \
  --amount 10.00 \
  --currency USD \
  --payment-instrument-id pi_xxx
Pay with session mode:
clink-cli pay --session-id sess_xxx --payment-instrument-id pi_xxx
If --payment-instrument-id is omitted, pay uses the default cached payment method.

5. Refund an order

Create a full refund:
clink-cli refund create --order-id order_xxx
Check refund status:
clink-cli refund get --refund-id rfd_xxx

6. Check risk rules

Get current risk rule settings:
clink-cli risk-rule get --format pretty
Open the risk rule page:
clink-cli risk-rule link --open

Common Usage

Use a named profile:
clink-cli wallet init --profile buyer-2 --email user2@example.com --name "Bob"
clink-cli wallet status --profile buyer-2 --format pretty
Override the base URL:
clink-cli wallet status --base-url https://uat-api.clinkbill.com
Print requests without executing them:
clink-cli pay \
  --merchant-id merchant_xxx \
  --amount 10.00 \
  --currency USD \
  --payment-instrument-id pi_xxx \
  --dry-run

Commands

Command groups:
  • clink-cli wallet init
  • clink-cli wallet status
  • clink-cli card binding-link
  • clink-cli card setup-link
  • clink-cli card modify-link
  • clink-cli card list
  • clink-cli card get --payment-instrument-id <id>
  • clink-cli risk-rule get
  • clink-cli risk-rule link
  • clink-cli pay --merchant-id <id> --amount <amount> --currency <currency>
  • clink-cli pay --session-id <id>
  • clink-cli refund create --order-id <id>
  • clink-cli refund get --refund-id <id>
  • clink-cli config set <key> <value>
  • clink-cli config get
  • clink-cli config unset <key>
Show help:
clink-cli --help
clink-cli wallet --help
clink-cli card --help
clink-cli refund --help

Configuration

Useful config commands:
clink-cli config get
clink-cli config set base-url https://uat-api.clinkbill.com
clink-cli config set customer-id cus_xxx --profile buyer-2
clink-cli config set customer-api-key sk_test_xxx --profile buyer-2
clink-cli config unset customer-api-key --profile buyer-2
Supported config keys:
  • base-url
  • customer-id
  • customer-api-key
  • default-open-links
  • email
  • name
Resolution order:
  1. Command flags
  2. Environment variables
  3. Saved profile config
Environment variables:
  • CLINK_BASE_URL
  • CLINK_CUSTOMER_ID
  • CLINK_CUSTOMER_API_KEY

Global Options

  • --format <json|pretty>
  • --dry-run
  • --open
  • --profile <name>
  • --base-url <url>
  • --customer-id <id>
  • --customer-api-key <key>
  • --timeout <ms>
  • --help