@chargebee/cli
v1.4.2
Published
Chargebee CLI — Build with Chargebee from the terminal
Downloads
1,589
Maintainers
Readme
Chargebee CLI
Build and test your Chargebee integration from the terminal.
With the Chargebee CLI, you can:
- Work with Chargebee API resources such as customers, subscriptions, invoices, items, and more.
- Stream webhook events directly to your local application.
- Generate runnable SDK code from API commands using
--code-sample.
Installation
The Chargebee CLI is available for macOS, Linux, and Windows.
macOS / Linux
curl -fsSL https://raw.githubusercontent.com/chargebee/cli/main/install.sh | bashOn musl-based Linux distributions, install the libstdc++ and libgcc runtime libraries with your package manager first. On Alpine, run apk add --no-cache libstdc++ libgcc. The installer selects the musl build automatically; glibc-based distributions use the standard Linux build.
The installer can also add the Chargebee skill for detected coding agents. To choose agents manually, decline the prompt and run:
chargebee skills add --global --agent cursorRepeat --agent for each agent.
Windows (PowerShell)
irm https://raw.githubusercontent.com/chargebee/cli/main/install.ps1 | iexnpm (requires Node.js 22+)
npm install -g @chargebee/cliVerify the installation:
chargebee --versionUpgrade to the latest version:
chargebee updatePrebuilt binaries are available on the Releases page.
Configuration
Connect the CLI to your Chargebee site:
chargebee auth addThe CLI prompts for your site name and API key, verifies them, and saves the profile locally.
API keys are stored in macOS Keychain, Linux Secret Service, or Windows Credential Manager when available. Otherwise, they are saved in the local profile file. auth add reports the storage used.
You can also pass credentials directly:
chargebee auth add --site acme-test --api-key test_xxxxxxxxxxxxOr use environment variables:
export CHARGEBEE_SITE=acme-test
export CHARGEBEE_API_KEY=test_xxxxxxxxxxxxCreate API keys from Settings → Configure Chargebee → API Keys in the Chargebee Dashboard.
Write operations are blocked on live sites. Use a test site when building or testing integrations.
Quick Example
Create a customer:
chargebee customer create \
-d [email protected] \
-d first_name=Ada \
-d last_name=Lovelace \
-d auto_collection=offPass request parameters as JSON on stdin with -:
echo '{"email":"[email protected]","first_name":"Ada","billing_address":{"city":"San Francisco"}}' \
| chargebee customer create -
echo '{"id":{"is":"cbdemo_alex"}}' | chargebee customer list -
echo '{"status":{"in":["active","paused"]}}' | chargebee subscription list -Retrieve the customer:
chargebee customer retrieve <customer-id>API responses are JSON, so standard tools work as expected:
chargebee customer list | jq '.list[].customer.email'JSON output
API commands print readable JSON by default. Use --json when you need compact output for scripts:
chargebee customer list --json | jq '.list[].customer.id'
chargebee auth status --jsonIn JSON mode, successful commands write JSON to stdout. Failures write a JSON error to stderr.
Commands
| Command | Description |
|---|---|
| auth | Add API-key credentials and manage saved profiles. |
| whoami | Show the active site and configuration. |
| resources | List available API resources. |
| <resource> <operation> | Call a Chargebee API. |
| docs | Browse API documentation from the terminal. |
| listen | Forward webhook events to a local URL. |
| skills | Install the Chargebee skill for supported AI coding agents. |
| open | Open Chargebee Dashboard pages. |
| feedback | Share feedback about the CLI. |
| alias | Configure a shell alias for chargebee. |
| update | Update the CLI. |
| telemetry | Manage CLI telemetry. |
Explore commands with:
chargebee --help
chargebee <resource> --help
chargebee <resource> <operation> --helpFor API parameters and operations:
chargebee docs <resource> <operation>Generate SDK Code
Use --code-sample <language> to generate runnable SDK code instead of making the API request:
chargebee customer create \
-d [email protected] \
--code-sample pythonSupported languages include curl, python, nodejs, go, java, php, ruby, and dotnet.
To see all supported languages:
chargebee customer create --code-sample listWebhook Forwarding
Listen for webhook events and forward them to your local application:
chargebee listen --forward-to http://localhost:3000/webhooksUse --json for machine-readable listener output:
chargebee listen --forward-to http://localhost:3000/webhooks --jsonPress Ctrl+C to stop listening.
Use with AI Agents
Install Chargebee skills for your coding agent:
chargebee skills add --list
chargebee skills add --agent claude-codeUse --global for user-wide installation. See chargebee skills --help and chargebee skills add --help for options.
Uninstall
Remove the CLI using the same installation method you used.
npm
npm uninstall -g @chargebee/climacOS / Linux installer
rm "$(command -v chargebee)"Windows
Remove-Item (Get-Command chargebee).SourceRemove CLI configuration and local state:
rm -rf ~/.chargebee/cliTelemetry
The Chargebee CLI collects limited usage telemetry to improve the CLI. Opt out with:
chargebee telemetry disableSee TELEMETRY.md for details.
Documentation
Browse API documentation from the CLI:
chargebee docsFeedback
Found a bug or have a feature request?
chargebee feedback "what happened"Contributing
See CONTRIBUTING.md for details on contributing to the Chargebee CLI.
