TypeScript SDK

Install and start using the TypeScript 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

The SDK compiles to dist/ before it can be referenced — run its build script once in the SDK folder, then add it to your project by path:

Terminal
npm install <path-to-sdk>

Quick Start

Create one client and reuse it. Configure its behaviour through ClientOptions.

TypeScript
import { MaxioAdvancedBillingClient, ServerEnvironment } from "maxio-advanced-billing";

const client = new MaxioAdvancedBillingClient({
  serverEnvironment: ServerEnvironment.Us,
  basicAuth: { username: "YOUR_USERNAME", password: "YOUR_PASSWORD" },
});

Nothing in ClientOptions is required — new MaxioAdvancedBillingClient() compiles — and each option left out falls back to its default. serverEnvironment is spelled out above so the environment a call reaches is visible where the client is built rather than inherited silently.

From CommonJS

The package ships both dialects from a single entry, so require works with full types. In a TypeScript CommonJS file use the import ... = require(...) form — a plain destructuring require runs fine but gives you any.

TypeScript
import sdk = require("maxio-advanced-billing");

const client = new sdk.MaxioAdvancedBillingClient({
  serverEnvironment: sdk.ServerEnvironment.Us,
  basicAuth: { username: "YOUR_USERNAME", password: "YOUR_PASSWORD" },
});

On this page