Chargify.NET Library

The Chargify.NET client library is an open source library created to interact with Chargify's API from your ASP.NET website. The library interacts with Chargify's REST API.

View the NuDoc documentation for the Nuget library here: NuDoc


- After downloading the library, in Visual Studio - add a reference to the Chargify.NET DLL.
- You can either configure Chargify.NET in two ways. 1) Use the ChargifyPage base page and web.config chargify section, or 2) Enter in AppSettings and create ChargifyConnect yourself.
- In either app.config or web.config, add the following:
        <section name="chargify" type="ChargifyNET.Configuration.ChargifyAccountRetrieverSection"/>
    <chargify defaultAccount="TestSiteAccount">
        <add name="TestSiteAccount" site="" apiKey="AbCdEfGhIjKlMnOpQrSt" apiPassword="P" sharedKey="AbCdEfGhIjKlMnOpQrSt" />
- If using the hosted page generation methods, you'll need to specify the sharedKey.

- If you aren't using the config section or the ChargifyPage base page - then just specify the Url, API Key, Password and SharedKey yourself in AppSettings. Then you can instantiate the ChargifyConnect class like so:
    // values for Url, API key, Password and SharedKey are declared above this.
    ChargifyConnect chargify = new ChargifyConnect();
    chargify.apiKey = myApiKey;
    chargify.Password = myPassword;
    chargify.URL = myChargifyUrl;
    chargify.SharedKey = myHostedPageSharedKey;

    // the chargify object is now instantiated and can connect when you make any call.
If there are any issues using this library, I encourage you to post an issue and I'll make sure I get it fixed immediately. The Chargify guys have done such a great job creating the service, I just want to make sure my .NET fellows can take advantage of it.

Example Usage
Here's some VB code that inherits from the included System.Web.UI.Page called ChargifyPage, and accesses the ChargifyConnect object.
Import ChargifyNET
Partial Class Default
    Inherits ChargifyPage

    Protected Sub Page_Load(ByVal sender as Object, ByVal e As EventArgs) Handles Me.Load
        If Not Me.IsPostBack Then
            Dim customer As ICustomer = Chargify.LoadCustomer(Membership.GetUser().ProviderUserKey)
        End If
    End Sub

End Class

Here's some C# code that inherits from the included System.Web.UI.Page called ChargifyPage, and accesses the ChargifyConnect object.
using ChargifyNET;
public partial class Default : ChargifyPage
    protected void Page_Load(Object sender, EventArgs e) 
        if (!this.IsPostBack) {
            ICustomer customer = Chargify.LoadCustomer(Membership.GetUser().ProviderUserKey);


Here are some examples:
// Retrieve a list of all your products
IDictionary<string, IProduct> products = chargify.GetProductList();

// Create a new customer
ICustomer newCustomer = chargify.CreateCustomer("Charlie", "Bull", "", "Chargify", Guid.NewGuid());

// Create a new customer and subscription
ICustomerAttributes charlie = new CustomerAttributes("Charlie", "Bull", "", "Chargify", Guid.NewGuid());
ICreditCardAttributes charliesPaymentInfo = new CreditCardAttributes();
charliesPaymentInfo.FirstName = charlie.FirstName;
charliesPaymentInfo.LastName = charlie.LastName;
charliesPaymentInfo.ExpirationMonth = 1;
charliesPaymentInfo.ExpirationYear = 2020;
charliesPaymentInfo.FullNumber = "1";
charliesPaymentInfo.CVV = "123";
charliesPaymentInfo.BillingAddress = "123 Main St.";
charliesPaymentInfo.BillingCity = "New York";
charliesPaymentInfo.BillingCountry = "United States";
charliesPaymentInfo.BillingState = "New York";
charliesPaymentInfo.BillingZip = "90210";

ISubscription newSubscription = chargify.CreateSubscription("basic", charlie, charliesPaymentInfo);
if (newSubscription == null) {
    // subscription failure.

Last edited Oct 16, 2013 at 7:34 PM by djbyter, version 5


AbhishekShanker Jul 12, 2012 at 6:38 AM 
How can i use this library in appsetting. And i am using hosted page generation methods ,so where should i instantiate the chargify Connection. what will i write in place of url.

JoshSommers Mar 22, 2012 at 8:02 PM 
I am interested in using this with Silverlight. Any info available on that?

lokesh12345 Nov 21, 2011 at 9:31 AM 
I am working in C#. How do I use webhooks to get the responses?

lokesh12345 Nov 21, 2011 at 9:27 AM 
Do the apiKey and sharedKey has to be the same?
If not, I am using them as same and able to fetch all the functions of the chargify. Is it the correct or the wrong way?
If wrong, what I have to do for correct values?

lokesh12345 Sep 29, 2011 at 10:27 AM 
Hi, I am getting error while adding in web.config
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SystemeticRev_Payment.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="chargify" type="ChargifyNET.Configuration.ChargifyAccountRetrieverSection"/>
<chargify defaultAccount="TestSiteAccount">
<add name="TestSiteAccount" site="" apiKey="5jgCGE9Tkr4gmYnlWIa-" apiPassword="x" sharedKey="5jgCGE9Tkr4gmYnlWIa-" />

Birdchest Jul 1, 2010 at 1:27 AM 
The config section should like this below

<chargify defaultAccount="sample">
<add name="sample" site="https://[your-site]" apiKey="[api-key-found-at-account-level]" apiPassword="x" sharedKey="[key-found-at-site-level]" />