Chargebee provides HTTP based REST APIs for integrating your application with Chargebee’s subscription management system. HTTP protocol's rules are followed thereby enabling simple HTTP client tools like "curl" to be used.
On top of this, we also provide API clients libraries for 6 languages, which provide an "easy to use" wrapper around the raw HTTP based API.
To get you started with APIs quickly, we have a collection of sample apps to demonstrate typical scenarios where APIs could be used. These apps would help you understand how our APIs could be used in your application workflow. You can find the list of sample apps along with tutorials for building them over here: Chargebee API Tutorials
Authentication
Chargebee uses HTTP BASIC Auth for authenticating the API calls. The user name is your API key and the password is empty. The API key could be obtained from 'API Keys' link under Settings (Configure Chargebee) -> API Keys (under API & Webhooks) in your Chargebee site.
Note: The API keys are different for your test site and your live site.
Request
The HTTP methods (like GET,POST) determines the operation type on the resource. Query parameters allow you to provide additional options to the GET requests. POST parameters provide the data to write operations like creation, modification of resource(s).
Response
The response is in JSON format. Currently Chargebee does not support any other response format.
Error Handling
HTTP status codes are used to indicate success or failure of an API call. The body of the response contains the details of the error in JSON format
The standard http status codes used are:
2XX The response code in this range implies the API call has succeeded.
3XX This range is not used currently.
4XX response codes indicate failure due to wrong input (i.e, client) side. As the usable list of http codes in the 4xx range is limited we predominantly use the 400 ( BAD REQUEST ) error code for client side errors.
5XX response codes indicate API request was valid but failed due to bugs on the Chargebee server side.
Error Handling Recommendations
Chargebee will return the first encountered error when validating the API call. Hence we strongly recommend you to validate the user input on your side before calling Chargebee's API. Otherwise you will have to show the mistakes one at a time for the user to correct it before proceeding to the next.
You can learn more about Chargebee’s APIs along with Sample API Calls and Sample Response from our API Document page: Chargebee API Overview
Useful links: