C# SDK

Install and start using the C# SDK.

Intro

The Maxio Advanced Billing SDK provides access to the Maxio Advanced Billing REST APIs.

Maxio Advanced Billing (formerly Chargify) provides an HTTP-based API that conforms to the principles of REST. One of the many reasons to use Advanced Billing is the immense feature set and client libraries. The Maxio API returns JSON responses as the primary and recommended format, but XML is also provided as a backwards compatible option for merchants who require it.

Steps to make your first Maxio Advanced Billing API call

  1. Sign-up or log-in to your test site account.
  2. Setup authentication credentials.
  3. Submit an API request and verify the response.
  4. Test the Advanced Billing integrations.

Next, you can explore authentication methods, basic concepts for interacting with Advanced Billing via the API, and the entire set of application-based documentation to aid in your discovery of the product.

Request Example

The following example uses the curl command-line tool to make an API request.

Request

curl -u <api_key>:x -H Accept:application/json -H Content-Type:application/json https://acme.chargify.com/subscriptions.json

Installation

Add the SDK as a project reference into your solution:

Terminal
dotnet add reference <path-to-sdk>/MaxioAdvancedBilling.csproj

Quick Start

Dependency Injection

Register the client with IServiceCollection and resolve it from the container. The HttpClient is managed by IHttpClientFactory. Configure the client's behavior through MaxioAdvancedBillingClientOptions.

C#
services.AddMaxioAdvancedBillingClient(options =>
{
    options.BasicAuth = new BasicAuthCredentials { Username = "YOUR_USERNAME", Password = "YOUR_PASSWORD" };
    options.Environment = ServerEnvironment.Us;
    // TODO: configure more client options here
});

Direct Instantiation

Create the client by passing an HttpClient you manage yourself. Configure the client's behavior through MaxioAdvancedBillingClientOptions.

C#
var httpClient = new HttpClient();
// TODO: configure more client options here
var options = new MaxioAdvancedBillingClientOptions
{
    BasicAuth = new BasicAuthCredentials { Username = "YOUR_USERNAME", Password = "YOUR_PASSWORD" },
    Environment = ServerEnvironment.Us,
};
var client = new MaxioAdvancedBillingClient(httpClient, options);

On this page