Chargebee provides HTTP based API which follows the essence of REST*. The HTTP protocol's rules are followed thereby enabling simple HTTP client tools like "curl" to be used.
The following client libraries provide a "easy to use" wrapper around the raw HTTP based API.
If you require support for additional languages, please raise a ticket on our support page.
Use the language bar at the top to view code examples in your chosen language.
Want us to generate ready-to-test snippets?
Login to Chargebee and open the API docs from there and you'll find ready-to-test sample codes based on your Chargebee test site's api key and data.Explore our suite of sample applications, complete with tutorials to guide your integration with Chargebee.
For in-depth explanations and definitions of all Chargebee components, consult our documentation.
Chargebee follows the REST model of exposing resources as urls. For example, subscriptions are exposed as
The TypeScript client library provide a corresponding class representation of the resource. For example, subscriptions are represented by
chargebee.subscription
All operations specific to that resource are exposed as class methods in the corresponding resource class. The methods accepts the input params as hash. You could also pass the environment configuration specific to that request as an additional parameter.
The response is in JSON format. Currently Chargebee does not support any other response format.
Note: Sometimes, while working with Chargebee APIs, you may see undocumented attributes returned in the response. Such attributes should be ignored.
import { ChargeBee, _subscription } from 'chargebee-typescript'; var chargebee = new ChargeBee(); chargebee.configure({site : "{site}", api_key : "{site_api_key}"}); chargebee.subscription.create({ plan_id : "no_trial", customer : { first_name : "John", last_name : "Doe", email : "john@user.com", auto_collection : "OFF" }, billing_address : { first_name : "John", last_name : "Doe", line1 : "PO Box 9999", city : "Walnut", state : "California", zip : "91789", country : "US" } }).request(function(error,result) { if(error){ //handle error console.log(error); }else{ console.log(`${result}`); var subscription: typeof chargebee.subscription = result.subscription; var customer: typeof chargebee.customer = result.customer; var card: typeof chargebee.card = result.card; var invoice: typeof chargebee.invoice = result.invoice; } });
import { ChargeBee, _subscription } from 'chargebee-typescript'; var chargebee = new ChargeBee(); chargebee.configure({site : "{site}", api_key : "{site_api_key}"}); chargebee.subscription.create({ plan_id : "no_trial", customer : { first_name : "John", last_name : "Doe", email : "john@user.com", auto_collection : "OFF" }, billing_address : { first_name : "John", last_name : "Doe", line1 : "PO Box 9999", city : "Walnut", state : "California", zip : "91789", country : "US" } }).request(function(error,result) { if(error){ //handle error console.log(error); }else{ console.log(`${result}`); var subscription: typeof chargebee.subscription = result.subscription; var customer: typeof chargebee.customer = result.customer; var card: typeof chargebee.card = result.card; var invoice: typeof chargebee.invoice = result.invoice; } });
Note: This library is intended for use on the server, not on the client.
The library can be installed using npmnpm install chargebee-typescript@">=2"Then import the library as:
import {ChargeBee} from 'chargebee-typescript'; var chargebee = new ChargeBee();
The source code for the client library is available as a public repository at github. The code is provided with MIT license. So in case you need any modifications please feel free to do so. If you think it would be useful for other users please do let us know.
Newer versions of client library are released whenever there are new additions to the API. The version
numbering format is major-version.minor-version(s). All
minor releases are backward compatible. Please check the
change notes
for more details.
The latest version details for API v1 are:
Version: 2.48.0
Released On: 2025-05-15
Chargebee supports the OpenAPI Specification to make it easier for developers to work with our APIs.
The spec is fully compliant with OpenAPI v3.0.1, enabling customers to:
This is part of our commitment to providing a smoother, more efficient developer experience.