Loading...
Loading...
Comprehensive integration guide for Chargebee billing platform. Provides API integration patterns, webhook handling, SDK usage, and schema references for billing operations. Use when working with Chargebee for (1) API integration and REST endpoint calls, (2) Processing webhook events, (3) Customer management operations, (4) Subscription lifecycle handling, (5) Payment and invoice processing, (6) Any other billing-related integration tasks with Chargebee platform.
npx skill4agent add chargebee/ai chargebee-integrationchargebee-initnpx chargebee-init@latest --dangerously-skip-checks --path=<full-path-to-app>README.md# Using requests library
import requests
CHARGEBEE_SITE = "your-site"
CHARGEBEE_API_KEY = "your_api_key"
headers = {
"Authorization": f"Basic {CHARGEBEE_API_KEY}",
"Content-Type": "application/json"
}
base_url = f"https://{CHARGEBEE_SITE}.chargebee.com/api/v2"
response = requests.get(
f"{base_url}/customers/{customer_id}",
headers=headers
)
# Using Python SDK
import chargebee
chargebee.configure(CHARGEBEE_API_KEY, CHARGEBEE_SITE)
result = chargebee.Customer.retrieve(customer_id)
customer = result.customerfrom flask import Flask, request
import chargebee
app = Flask(__name__)
@app.route('/chargebee/webhook', methods=['POST'])
def handle_webhook():
payload = request.data
signature = request.headers.get('X-Chargebee-Signature')
# Verify signature (recommended for security)
# chargebee.Webhook.verify_signature(payload, signature)
event = request.json
event_type = event['event_type']
# Process based on event type
if event_type == 'subscription_created':
handle_subscription_created(event['content'])
elif event_type == 'subscription_cancelled':
handle_subscription_cancelled(event['content'])
# ... handle other events
return '', 200