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.
Please do mail us at support if you need any other language bindings.
The top language bar allows you to see samples in your preferred 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.Checkout our collection of sample applications with tutorials on integrating with Chargebee.
Refer to our documentation for a detailed definition & description of all the components in Chargebee.
r a detailed definition & description of all the components in Chargebee.Chargebee follows the REST model of exposing resources as urls. For example, subscriptions are exposed as
The .Net client library provide a corresponding class representation of the resource. For example, subscriptions are represented by
ChargeBee.Models.Subscription
The client library exposes all operations specific to that resource as static methods in the corresponding resource class and they return a operation specific Request object. The "Request" objects expose a fluent API using which you could set the input parameters for the operation. After filling in the request parameters, invoke the request method to send the request. There is an additional overloaded request method that takes in environment configuration that is applied only for that request.
The response is in JSON format. Currently Chargebee does not support any other response format. The ChargeBee.Api.EntityResult class wraps the response sent by the server. It has methods that allow you to fetch the specific resource from the result. The ChargeBee.Api.ListResult class is used to wrap list responses.
Note: Sometimes, while working with Chargebee APIs, you may see undocumented attributes returned in the response. Such attributes should be ignored.
/* creates a subscription with customer information and billing details. */ using ChargeBee.Api; using ChargeBee.Models; ApiConfig.Configure("{site}","{site_api_key}"); EntityResult result = Subscription.Create() .PlanId("no_trial") .CustomerFirstName("John") .CustomerLastName("Doe") .CustomerEmail("john@user.com") .BillingAddressFirstName("John") .BillingAddressLastName("Doe") .BillingAddressLine1("PO Box 9999") .BillingAddressCity("Walnut") .BillingAddressState("California") .BillingAddressZip("91789") .BillingAddressCountry("US") .CustomerAutoCollection(AutoCollectionEnum.Off) .Request(); Subscription subscription = result.Subscription; Customer customer = result.Customer; Card card = result.Card; Invoice invoice = result.Invoice;
/* creates a subscription with customer information and billing details. */ using ChargeBee.Api; using ChargeBee.Models; ApiConfig.Configure("{site}","{site_api_key}"); EntityResult result = Subscription.Create() .PlanId("no_trial") .CustomerFirstName("John") .CustomerLastName("Doe") .CustomerEmail("john@user.com") .BillingAddressFirstName("John") .BillingAddressLastName("Doe") .BillingAddressLine1("PO Box 9999") .BillingAddressCity("Walnut") .BillingAddressState("California") .BillingAddressZip("91789") .BillingAddressCountry("US") .CustomerAutoCollection(AutoCollectionEnum.Off) .Request(); Subscription subscription = result.Subscription; Customer customer = result.Customer; Card card = result.Card; Invoice invoice = result.Invoice;
> Install-Package ChargeBee -Version 1.6.5
Note: Supports .NET framework 3.0 and higher.
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: 1.6.5
Released On: 2019-08-27