微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🧾

企业级订阅计费一键管控

Chargebee · v1.0.7
专业技能 安全 A 级 作者 byungkyu 公开目录收录
5.3k 下载 3 安装 16.3k 收藏 32 浏览

简介

通过 Maton 代理网关安全接入 Chargebee API,实现订阅管理、客户运营与发票处理的企业级计费自动化

原始描述

Chargebee API integration with managed OAuth. Install only if you need Chargebee billing administration. Connect with least-privilege access, verify the inte...

通过你的 Agent 添加

安装目录:chargebee/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/chargebee/
Codex CLI~/.codex/skills/chargebee/
DeepSeek Harness~/.agents/skills/chargebee/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

该 Skill 提供通过 Maton 网关代理访问 Chargebee API 的完整指南,支持订阅管理、客户管理、发票处理、托管页面生成等核心计费功能。用户需先在 Maton 平台创建 OAuth 连接,获取 API Key 后通过标准 HTTP 请求调用接口。

主要功能模块:

  • 客户管理:创建、更新、查询客户信息
  • 订阅管理:创建订阅、取消订阅、查询状态
  • 发票处理:查询发票列表、下载 PDF
  • 产品目录 2.0:管理 item_prices 和 items
  • 托管页面:生成 Checkout 和 Portal 会话

认证方式:使用 MATON_API_KEY 环境变量 + Bearer Token 认证,支持多连接场景下通过 Maton-Connection 头部指定目标账户。

显著优点

  1. 托管 OAuth 简化集成:无需自行处理 Chargebee 复杂的 OAuth 流程,Maton 网关自动管理令牌刷新和请求代理
  2. 完整文档覆盖:提供 Python、JavaScript、curl 等多语言示例,涵盖 CRUD 操作和高级过滤
  3. 明确安全指引:文档强制要求写操作前二次确认,明确标注财务操作的高风险性
  4. 多连接管理:支持同时管理多个 Chargebee 账户,通过头部显式指定避免误操作

潜在缺点与局限性

  1. 网关依赖风险:所有请求必须通过 Maton 网关 (api.maton.ai),存在单点故障和数据中转的隐私顾虑
  2. 功能受限:仅支持文档中明确列出的端点,无法调用 Chargebee 全部 API 功能
  3. 速率限制:明确标注 10 req/sec 的速率限制,高并发场景可能受限
  4. 无 SDK 封装:纯文档型 Skill,需自行处理请求构造、错误处理和分页逻辑

适合人群

  • SaaS 运营团队:需要批量管理订阅、处理客户计费查询
  • 财务自动化开发者:构建发票同步、收入对账等自动化流程
  • 多租户平台管理员:同时管理多个 Chargebee 账户的复杂场景
  • 技术背景产品经理:需要直接操作数据生成运营报表

常规风险

风险类型 说明 缓解措施
数据外泄 财务数据经 Maton 网关中转 审计 Maton 隐私政策,敏感字段脱敏
误操作损失 订阅取消、客户更新不可逆 严格执行"先查后改"+用户确认流程
密钥泄露 MATON_API_KEY 环境变量访问 最小权限配置,定期轮换,禁止日志打印
连接混淆 多账户场景下操作错误账户 始终使用 Maton-Connection 头部显式指定
速率限制 突发流量触发 429 错误 实现指数退避重试机制

技能正文


name: chargebee description: | Chargebee API integration with managed OAuth. Install only if you need Chargebee billing administration. Connect with least-privilege access, verify the intended connection ID before each request, and revoke unused connections promptly. This integration can mutate billing data — approve only specific write actions after checking the exact endpoint, account, resource ID, and consequence. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). compatibility: Requires network access and valid Maton API key metadata: author: maton version: "1.0" clawdbot: emoji: 🧠 requires: env: - MATON_API_KEY

Chargebee

Access the Chargebee API with managed OAuth authentication. Manage subscriptions, customers, invoices, and billing workflows.

Quick Start

# List customers
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/chargebee/api/v2/customers?limit=10')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Base URL

https://api.maton.ai/chargebee/{endpoint-path}

The gateway proxies requests to {subdomain}.chargebee.com (automatically replaced with your connection config) and injects authentication. Only the endpoints documented in the API Reference section below are supported — always use specific endpoint paths from that section rather than constructing arbitrary paths.

Authentication

All requests require the Maton API key in the Authorization header:

Authorization: Bearer $MATON_API_KEY

Environment Variable: Set your API key as MATON_API_KEY:

export MATON_API_KEY="YOUR_API_KEY"

Getting Your API Key

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key

Connection Management

Manage your Chargebee connections at https://api.maton.ai.

List Connections

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections?app=chargebee&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Create Connection

python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'chargebee'}).encode()
req = urllib.request.Request('https://api.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Get Connection

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Response:

{
  "connection": {
    "connection_id": "{connection_id}",
    "status": "ACTIVE",
    "creation_time": "2025-12-08T07:20:53.488460Z",
    "last_updated_time": "2026-01-31T20:03:32.593153Z",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "chargebee",
    "metadata": {}
  }
}

Open the returned url in a browser to complete OAuth authorization.

Delete Connection

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Specifying Connection

If you have multiple Chargebee connections, specify which one to use with the Maton-Connection header:

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/chargebee/api/v2/customers')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '{connection_id}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Always include the Maton-Connection header to ensure requests go to the intended Chargebee account, especially before any write operation. If you have multiple connections and omit this header, the gateway uses a default connection, which may not be the intended account.

Security & Permissions

  • Access is scoped to the Chargebee resources permitted by the connected account's credentials. Only install if you need Chargebee billing administration. Use least-privilege access and revoke unused connections promptly.
  • Default to read-only operations. Always start by listing or retrieving resources to confirm identifiers before proposing any changes.
  • All write operations require explicit user approval with specific details. Before executing any POST, PUT, or cancel/delete call:
    1. Retrieve and display the target resource (customer name/ID, subscription ID, invoice number) so the user can verify.
    2. Clearly describe the intended effect (e.g., "This will cancel subscription 'sub_123' for customer 'Acme Corp' — billing will stop at end of term").
    3. Wait for explicit user confirmation before proceeding.
  • Billing operations are high-impact. Any action that affects subscriptions, invoices, or customer billing records must include a summary of financial consequences and require confirmation.

API Reference

Customers

List Customers
GET /chargebee/api/v2/customers?limit=10
Get Customer
GET /chargebee/api/v2/customers/{customerId}
Create Customer
POST /chargebee/api/v2/customers
Content-Type: application/x-www-form-urlencoded

first_name=John&last_name=Doe&email=john@example.com
Update Customer
POST /chargebee/api/v2/customers/{customerId}
Content-Type: application/x-www-form-urlencoded

first_name=Jane

Subscriptions

List Subscriptions
GET /chargebee/api/v2/subscriptions?limit=10
Get Subscription
GET /chargebee/api/v2/subscriptions/{subscriptionId}
Create Subscription
POST /chargebee/api/v2/subscriptions
Content-Type: application/x-www-form-urlencoded

plan_id=basic-plan&customer[email]=john@example.com&customer[first_name]=John
Cancel Subscription
POST /chargebee/api/v2/subscriptions/{subscriptionId}/cancel
Content-Type: application/x-www-form-urlencoded

end_of_term=true

Item Prices (Product Catalog 2.0)

List Item Prices
GET /chargebee/api/v2/item_prices?limit=10

Items

List Items
GET /chargebee/api/v2/items?limit=10

Invoices

List Invoices
GET /chargebee/api/v2/invoices?limit=10
Download Invoice PDF
POST /chargebee/api/v2/invoices/{invoiceId}/pdf

Hosted Pages

Checkout New Subscription
POST /chargebee/api/v2/hosted_pages/checkout_new_for_items
Content-Type: application/x-www-form-urlencoded

subscription[plan_id]=basic-plan&customer[email]=john@example.com

Portal Sessions

Create Portal Session
POST /chargebee/api/v2/portal_sessions
Content-Type: application/x-www-form-urlencoded

customer[id]=cust_123

Filtering

GET /chargebee/api/v2/subscriptions?status[is]=active
GET /chargebee/api/v2/customers?email[is]=john@example.com
GET /chargebee/api/v2/invoices?date[after]=1704067200

Code Examples

JavaScript

const response = await fetch(
  'https://api.maton.ai/chargebee/api/v2/customers?limit=10',
  {
    headers: {
      'Authorization': `Bearer ${process.env.MATON_API_KEY}`
    }
  }
);

Python

import os
import requests

response = requests.get(
    'https://api.maton.ai/chargebee/api/v2/customers',
    headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
    params={'limit': 10}
)

Notes

  • Uses form-urlencoded data for POST requests
  • Nested objects use bracket notation: customer[email]
  • Timestamps are Unix timestamps
  • List responses include next_offset for pagination
  • Product Catalog 2.0: use item_prices and items
  • IMPORTANT: When using curl commands, use curl -g when URLs contain brackets (fields[], sort[], records[]) to disable glob parsing
  • IMPORTANT: When piping curl output to jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments. You may get "Invalid API key" errors when piping.

Error Handling

Status Meaning
400 Missing Chargebee connection
401 Invalid or missing Maton API key
429 Rate limited (10 req/sec per account)
4xx/5xx Passthrough error from Chargebee API

Troubleshooting: API Key Issues

  1. Check that the MATON_API_KEY environment variable is set:
echo $MATON_API_KEY
  1. Verify the API key is valid by listing connections:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://api.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Troubleshooting: Invalid App Name

  1. Ensure your URL path starts with chargebee. For example:
  • Correct: https://api.maton.ai/chargebee/api/v2/customers
  • Incorrect: https://api.maton.ai/api/v2/customers

Resources

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

billingsubscription-managementinvoicingoauthsaaspaymentchargebeefintechapi-gatewayenterprise

同类 Skill