for developers

Ship subscriptions
in an afternoon.

One SDK for PayChangu, PawaPay, and OneKhusa. Type-safe, zero vendor lock-in, and a managed platform that handles your billing infrastructure.

3providers
1interface
0vendor lock-in
$npm install chia-sdkcopied
quickstart.ts
webhook.ts
types.d.ts
1import { ChiaSDK } from 'chia-sdk'
2 
3const chia = ChiaSDK.initialize({
4 provider: 'paychangu',
5 secretKey: process.env.PAYCHANGU_SECRET_KEY
6})
7 
8const plan = await chia.plans.create({
9 name: 'Pro Monthly',
10 amount: 2500,
11 currency: 'MWK',
12 interval: 'monthly'
13})
14 
15const subscription = await chia.subscriptions.create({
16 planId: plan.id,
17 phone: '+265888123456',
18 email: 'user@example.com'
19})
code examples

Real code, not pseudocode.

plans

Create a plan

Define billing intervals, amounts, and currencies.

const plan = await chia.plans.create({
name: 'Starter',
amount: 1000,
currency: 'MWK',
interval: 'monthly'
})
payments

Collect a payment

Initiate a mobile money collection in one call.

const payment = await chia.payments.collect({
amount: 5000,
currency: 'MWK',
phone: '+265888123456'
})
status

Check payment status

Poll or webhook - your choice. Status is always current.

const status = await chia.payments.status(
payment.id
)
 
// { status: 'success', provider: 'paychangu' }
providers

Switch providers

Change one line. Everything else stays the same.

const chia = ChiaSDK.initialize({
provider: 'pawapay', // was 'paychangu'
jwt: process.env.PAWAPAY_JWT
})
 
// all other code stays identical
sdk features

Built for developers
who ship.

{T}

Full TypeScript

Every method, every response, every error - fully typed.

Singleton pattern

Initialize once, use everywhere. No prop drilling.

</>

Provider adapters

PayChangu, PawaPay, OneKhusa behind one interface.

Validation built-in

Catches bad inputs before they hit the network.

~

Biome linting

Consistent code style enforced at the SDK level.

Clean exports

Import from package root. No deep path imports.

ai integration

MCP server included.

chia-mcp exposes every SDK operation as an MCP tool. Connect it to Claude, Cursor, or any MCP-compatible assistant and manage subscriptions through natural language.

Create plans, collect payments, check statuses, and cancel subscriptions - all without leaving your AI workflow.

create_plan

Create a subscription plan with amount, currency, and interval.

list_subscribers

Query subscribers by status, plan, or search term.

collect_payment

Initiate a mobile money collection from a phone number.

check_status

Get the current status of any payment by ID.

cancel_subscription

Cancel an active subscription immediately or at period end.

deployment

Get started in minutes.

terminal
step 01

Create an account

# Join waitlist at usechia.com
# Get your API key from the dashboard
step 02

Install the SDK

$ npm install chia-sdk
step 03

Collect payments

# Configure your provider
# Create a plan and start collecting

Start building with Chia.