Chargebee
Read and create core Chargebee data — customers, subscriptions, and invoices — for recurring/subscription billing via the Chargebee REST API.
Standard library only (urllib, json, base64). No third-party packages, no credential object required — the API key and site name are passed as inputs.
What it does
Branches on operation and calls the Chargebee v2 REST API for your site:
| Operation | Method | Endpoint |
|---|---|---|
list_customers |
GET | /api/v2/customers?limit=N |
get_customer |
GET | /api/v2/customers/{customerId} |
create_customer |
POST | /api/v2/customers (form-encoded: email, first_name, last_name, company) |
list_subscriptions |
GET | /api/v2/subscriptions?limit=N |
get_subscription |
GET | /api/v2/subscriptions/{subscriptionId} |
list_invoices |
GET | /api/v2/invoices?limit=N |
get_invoice |
GET | /api/v2/invoices/{invoiceId} |
It returns:
result— the Chargebee JSON payload as a JSON string (re-parseable by downstream steps).status— the HTTP status code as a string.
Non-2xx responses from Chargebee (e.g. 401 invalid key, 404 not found) are returned with their status and body rather than failing the step, so the caller can react. Only transport-level failures (DNS, connection refused, timeout) fail the step.
Response bodies are capped at ~5 MB.
Base URL & authentication
- Base URL:
https://{site}.chargebee.com/api/v2—{site}is your Chargebee site name (the subdomain you log in to, e.g.acme-test). - Auth: HTTP Basic. The API key is the username; the password is
empty (
Authorization: Basic base64("<api_key>:")). All requests use HTTPS.
apiKey setup
- Sign in to your Chargebee admin console.
- Go to Settings → Configure Chargebee → API Keys.
- Create or copy an API key (use a test-site key while developing).
- Note your site name — it's the subdomain in your Chargebee URL
(
https://{site}.chargebee.com).
Pass the key as apiKey and the subdomain as site. The site input accepts
either a bare name (acme-test) or a full host
(acme-test.chargebee.com) — it is normalized to the subdomain.
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
apiKey |
yes | — | Chargebee API key (HTTP Basic username) |
operation |
yes | — | One of the operations above |
site |
yes* | "" |
Chargebee site name / subdomain |
customerId |
for get_customer |
"" |
Customer id |
subscriptionId |
for get_subscription |
"" |
Subscription id |
invoiceId |
for get_invoice |
"" |
Invoice id |
email |
for create_customer |
"" |
Customer email |
firstName |
for create_customer |
"" |
Customer first name |
lastName |
for create_customer |
"" |
Customer last name |
company |
for create_customer |
"" |
Customer company |
limit |
no | 10 |
Page size for list operations (1–100) |
* site is declared with a default of "" per tool convention but is
required at runtime for every operation.
Examples
List the 10 most recent customers:
operation = list_customers
apiKey = <your_api_key>
site = acme-test
Retrieve one subscription:
operation = get_subscription
apiKey = <your_api_key>
site = acme-test
subscriptionId = __test__8asukSOXdvdpAQ
Create a customer:
operation = create_customer
apiKey = <your_api_key>
site = acme-test
email = [email protected]
firstName = Jane
lastName = Doe
company = Acme Inc
List the latest invoices:
operation = list_invoices
apiKey = <your_api_key>
site = acme-test
limit = 25