Developers

Recurring billing in one import.

A type-safe, open-source TypeScript SDK over every mobile money rail. Initialize once, create a collection, listen for one webhook shape. That's the integration.

$ terminal
$ npm i @chiahq/sdk added 1 package in 1.2s $ npx chia init ✓ sandbox keys written to .env ✓ test wallets ready: airtel, mpamba, momo
Quickstart · 1 of 2

Initialize the singleton.

One credential set. Chia handles provider selection at charge time - you never write per-PSP code, and sandbox and production are a key swap apart.

setup.ts
import { ChiaSDK } from "@chiahq/sdk" ChiaSDK.initialize({ secretKey: process.env.CHIA_SECRET_KEY, environment: "sandbox", }) const sdk = ChiaSDK.getInstance()
Quickstart · 2 of 2

Charge, then follow the action.

Every charge returns a typed next_action telling your UI exactly what to render - a redirect, a USSD code to dial, or nothing but a webhook to wait for.

  • redirect - send the customer to a provider page
  • ussd_prompt / pin_prompt / tan_prompt - approval on the handset
  • wait_for_webhook - nothing to render; we call you
charge.ts
const payment = await sdk.collections.create({ amount: 4500, currency: "MWK", phone: "+265 884 123 456", }) switch (payment.nextAction.type) { case "ussd_prompt": show(`Dial ${payment.nextAction.code}`) case "wait_for_webhook": // nothing to do - listen below }
Webhooks

One shape. Signed. Deduplicated.

Three providers' callbacks become one event schema. Verify the signature, switch on the event name, return 200. Undelivered events retry with backoff and sit in a replayable log.

  • HMAC signature on every delivery
  • Idempotency keys - safe to process twice
  • One-click replay from the dashboard
webhook payload
{ "id": "evt_9f2c81", "event": "payment.success", "data": { "subscriber": "sub_1847", "amount": 4500, "currency": "MWK", "attempt": 2 } }
And the rest

Sandbox, MCP, headless.

Everything around the SDK that makes billing shippable in a sprint.

  • Sandbox test wallets that simulate empty balances, timeouts and PIN rejections
  • Intents API for a fully headless checkout in your own UI
  • @chiahq/mcp server - Claude and other assistants can operate your billing
  • Open source SDK - read every line before you trust it with money
mcp.json
{ "mcpServers": { "chia": { "command": "npx", "args": ["@chiahq/mcp"] } } } // "How much MRR did we add this week?"

Ship billing this sprint, not this quarter.