Chargebee has a REST API.
Chargebee provides an HTTP-based API that follows the principles of REST.
The API uses resource-oriented URLs, form-encoded request formats, and JSON responses.
It uses standard HTTP methods like GET for read operations and POST for write operations.
The API endpoints are structured around resources, for example:
https://{site}.chargebee.com/api/v2/subscriptions
Here's a simple example of making a GET request to the Chargebee API using cURL:
curl https://{site}.chargebee.com/api/v2/subscriptions/{subscription_id} \ -u {site_api_key}:
Use HTTPS for all API requests to ensure security.
Include your API key in the request for authentication.
Handle API responses and errors appropriately in your code.
Use the provided client libraries when possible to simplify API interactions.
Be aware of rate limits and implement proper error handling for API requests.
Yes, the official Chargebee API does have webhooks. Here are the key points about Chargebee's webhook functionality:
Chargebee provides webhooks to notify your systems about events as they occur in your Chargebee instance.
You can set up multiple webhook endpoints using the Chargebee console to be notified of various events.
Chargebee supports a wide range of event types that you can subscribe to via webhooks. Some examples include:
The full list of event types is available in the Chargebee API documentation.
Webhooks are sent as HTTP POST requests with content type application/json.
Each webhook contains detailed information about the event, including:
Chargebee supports multiple API versions, so you need to specify the API version when creating webhooks.
Webhooks are asynchronous and may not be suitable for time-critical applications. For such cases, Chargebee recommends using their List events API to poll for events.
Implement proper error handling and retries, as Chargebee will retry failed webhook deliveries up to 7 times at exponential intervals.
Be prepared to handle out-of-order delivery of webhooks.
Use the resource_version
attribute to order events and ensure you're processing the most up-to-date information.
Consider securing your webhook URL using basic authentication.
Be aware that Chargebee sends webhooks from specific IP addresses, which you may need to whitelist.
In summary, Chargebee's webhook system provides a robust way to integrate real-time event notifications into your application, covering a wide range of event types related to subscriptions, customers, payments, and more.
Here are the key points about the API rate limits for the Chargebee API:
Chargebee restricts API requests based on two criteria [1][2][3]:
The rate limits vary by Chargebee plan [1][2]:
Starter Plan:
Performance Plan:
Enterprise Plan:
When the rate limit is exceeded [1][2][3]:
When encountering rate limits [1]:
In summary, Chargebee implements API rate limiting based on requests per minute and concurrent requests, with limits varying by plan. Proper error handling and backoff strategies are recommended when working with the API.
The most recent version of the Chargebee API is V2.
Key points to consider:
Chargebee currently has two major API versions: V1 and V2.
V2 is the latest version of the Chargebee API. As stated in the documentation: "As all of our future development will happen in API V2, the latest version of Chargebee API, you might want to upgrade to V2 to benefit from the new functionality."
Within V2, there are sub-versions related to changes in the Product Catalog APIs.
The API version can be identified in several ways:
/api/v2
api_version
attribute indicates the versionBest practices:
Use the latest V2 version of the API to benefit from new features and improvements.
When upgrading from V1 to V2, review the API V2 Upgradation Guide to understand the changes and necessary modifications to your code.
Check the API changelog regularly to stay informed about new features and changes.
When using client libraries, ensure compatibility between the library version and the API version you're using.
When working with webhooks, be aware that the payload schema is determined by the API version.
Here's how to get a developer account for Chargebee to create an API integration:
Sign up for a Chargebee account:
Access your API keys:
Create a new API key:
Securely store your API key:
Start integrating:
Key points to consider:
By following these steps, you'll have a developer account set up with Chargebee and be ready to create your API integration using the provided API key.
Based on the Chargebee API documentation, here are the key data models you can interact with and what is possible for each:
This covers the core data models, but Chargebee offers many more capabilities through its API. The documentation provides full details on all available operations for each resource.