@clink-ai/clink-cli
v0.1.2
Published
TypeScript CLI for Clink customer wallet APIs
Readme
clink-cli
clink-cli is a command-line client for Clink customer wallet APIs.
Install
Install globally:
npm install -g @clink-ai/clink-cliRun without installing globally:
npx @clink-ai/clink-cli --helpPublished package name:
@clink-ai/clink-cliInstalled command:
clink-cliRequirements:
- Node.js
>=20 - Access to the target Clink API environment
Default base URL:
https://api.clinkbill.comQuick Start
Every command starts with:
clink-cli <command> [subcommand] [options]1. Initialize your wallet
Run this once to create or activate a customer wallet and save credentials locally:
clink-cli wallet init --email [email protected] --name "Alice"Check the saved profile:
clink-cli wallet status --format prettyThe local config file is stored at:
~/.clink-cli/config.json2. Open card pages
Get the raw binding link:
clink-cli card binding-linkOpen the add-card page:
clink-cli card setup-link --openOpen the manage-card page:
clink-cli card modify-link --open3. Check saved payment methods
List cached payment methods:
clink-cli card list --format prettyGet one cached payment method:
clink-cli card get --payment-instrument-id pi_xxxNotes:
- card add/update/delete happens on the web page, not in the CLI
card listandcard getread local cached datacard binding-link,card setup-link, andcard modify-linkrefresh 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_xxxPay with session mode:
clink-cli pay --session-id sess_xxx --payment-instrument-id pi_xxxIf --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_xxxCheck refund status:
clink-cli refund get --refund-id rfd_xxx6. Check risk rules
Get current risk rule settings:
clink-cli risk-rule get --format prettyOpen the risk rule page:
clink-cli risk-rule link --openCommon Usage
Use a named profile:
clink-cli wallet init --profile buyer-2 --email [email protected] --name "Bob"
clink-cli wallet status --profile buyer-2 --format prettyOverride the base URL:
clink-cli wallet status --base-url https://api.clinkbill.comPrint requests without executing:
clink-cli pay \
--merchant-id merchant_xxx \
--amount 10.00 \
--currency USD \
--payment-instrument-id pi_xxx \
--dry-runCommands
Command groups:
clink-cli wallet initclink-cli wallet statusclink-cli card binding-linkclink-cli card setup-linkclink-cli card modify-linkclink-cli card listclink-cli card get --payment-instrument-id <id>clink-cli risk-rule getclink-cli risk-rule linkclink-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 getclink-cli config unset <key>
Show help:
clink-cli --help
clink-cli wallet --help
clink-cli card --help
clink-cli refund --helpConfiguration
Useful config commands:
clink-cli config get
clink-cli config set base-url https://api.clinkbill.com
clink-cli config set customer-id cus_xxx --profile buyer-2
clink-cli config set customer-api-key sk_xxx --profile buyer-2
clink-cli config set webhook-sign-key whsec_xxx --profile buyer-2
clink-cli config unset customer-api-key --profile buyer-2Supported config keys:
base-urlcustomer-idcustomer-api-keywebhook-sign-keydefault-open-linksemailname
wallet init stores the webhook signing key on the selected profile. If --webhook-sign-key is omitted and the profile already has one, the CLI reuses that saved key; otherwise it generates a new 16-character alphanumeric key and persists it.
Resolution order:
- command flags
- environment variables
- saved profile config
Environment variables:
CLINK_BASE_URLCLINK_CUSTOMER_IDCLINK_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
Local Development
Build from source:
npm install
npm run build
node dist/index.js --helpRun tests:
npm test
npm run test:e2e