ChapSmart API
Bitcoin-to-mobile-money infrastructure for Tanzania. Send remittances, buy airtime, and purchase sats — all via Lightning Network with real-time pricing and sub-minute settlement.
Authentication
All API requests require authentication via API key headers. Contact our team to receive your credentials.
// Required headers for every request { "X-API-Key": "your_api_key", "X-API-Secret": "your_api_secret", "Content-Type": "application/json" }
Tiers & Fee Structure
Fees decrease as cumulative transaction volume grows. Tiers are calculated across all transaction types (remittance + airtime).
| Tier | Cumulative Volume | Remittance Fee |
|---|---|---|
| Bronze | 0 – 5,000,000 TZS | 2.20% |
| Silver | 5,000,001 – 25,000,000 TZS | 1.87% |
| Gold | 25,000,001+ TZS | 1.32% |
Authentication
Create anonymous accounts and authenticate users. No personal data required.
{}{
"success": true,
"accountNumber": "1234567890123456",
"message": "Account created successfully"
}{
"accountNumber": "1234567890123456"
}{
"success": true,
"accountNumber": "1234567890123456",
"message": "Login successful"
}Remittance
Send Bitcoin via Lightning and deliver TZS to any Vodacom M-Pesa number. Flow: Quote → Generate Invoice → Pay → Auto-delivery.
{
"metadata": {
"amountTZS": 25000,
"phoneNumber": "0741000000",
"recipientName": "John Doe",
"accountNumber": "1234567890123456"
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
| amountTZS | number | required | Amount in TZS (2,500 – 1,000,000) |
| phoneNumber | string | required | Vodacom M-Pesa number (07XX format) |
| recipientName | string | required | First and last name of recipient |
| accountNumber | string | required | Your 16-digit account number |
{
"success": true,
"quoteId": "abc123...",
"youPay": {
"sats": 14680,
"btc": "0.00014680",
"feeSats": 270,
"feePercent": 2.20
},
"userTier": "BRONZE"
}{
"quoteId": "abc123..."
}{
"success": true,
"invoiceId": "XYZ789...",
"bolt11": "lnbc...",
"checkoutLink": "https://pay.chapsmart.com/i/XYZ789",
"youPay": { "sats": 14680 }
}window.webln.sendPayment(bolt11) for one-click payment.{
"success": true,
"invoiceId": "XYZ789...",
"status": "completed",
"message": "Payment confirmed and M-Pesa sent!",
"type": "remittance"
}| Status | Meaning |
|---|---|
| pending | Waiting for Lightning payment |
| settled | Payment received, payout processing |
| completed | Payout delivered to recipient |
| expired | Invoice expired (not paid in time) |
| failed | Payout failed (support will resolve) |
Airtime Top-Up
Buy airtime for any Tanzanian mobile number using Lightning. Same flow: Quote → Generate → Pay → Delivered.
{
"metadata": {
"amountTZS": 1000,
"phoneNumber": "255741000000",
"accountNumber": "1234567890123456"
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
| amountTZS | number | required | Airtime amount (500 – 15,000 TZS) |
| phoneNumber | string | required | Phone number in 255 format (e.g. 255741000000) |
| accountNumber | string | required | Your 16-digit account number |
{
"quoteId": "airtime_quote_id..."
}Buy Sats
Purchase Bitcoin with M-Pesa. Flow: Quote → User pays M-Pesa → Submit transaction ID + BOLT11 → Sats delivered.
{
"amountTZS": 10000,
"accountNumber": "1234567890123456"
}{
"success": true,
"quoteId": "buy_quote_id...",
"calculatedSats": 5870,
"btcPrice": 97500
}| Parameter | Type | Required | Description |
|---|---|---|---|
| amountTZS | number | required | Amount to spend (1,000 – 100,000 TZS) |
| accountNumber | string | required | Your 16-digit account number |
{
"quoteId": "buy_quote_id...",
"mpesaId": "XKR4MPT9QZN",
"bolt11": "lnbc5870n1p..."
}{
"success": true,
"satsSent": 5870,
"message": "Sats delivered to your wallet"
}Data & History
Retrieve transaction history and account statistics.
{
"accountNumber": "1234567890123456"
}{
"success": true,
"transactions": [
{
"type": "remittance",
"amount": 25000,
"status": "completed",
"phoneNumber": "0741***890",
"createdAt": "2026-03-14T09:41:00Z"
}
],
"stats": {
"totalTransactions": 12
}
}{
"success": true,
"userTier": "BRONZE",
"feePercent": 2.20,
"cumulativeAmount": 450000,
"progressToNext": 4550000,
"nextTier": "SILVER",
"progressPercent": 9
}Error Handling
All errors return a consistent JSON structure with an error message.
{
"success": false,
"error": "Description of what went wrong"
}| Code | Meaning |
|---|---|
| 400 | Bad request — missing or invalid parameters |
| 403 | Forbidden — account not found or inactive |
| 404 | Not found — resource doesn't exist |
| 409 | Conflict — quote already used |
| 410 | Gone — quote has expired |
| 500 | Server error — contact support |
LNbits Extension
ChapSmart is available as an open-source LNbits extension. Install it on any LNbits instance to enable Bitcoin-to-M-Pesa cashouts directly from your Lightning wallet.
| Detail | Value |
|---|---|
| Minimum | 2,500 TZS (~$1 USD) |
| Maximum | 1,000,000 TZS (~$390 USD) |
| Fee | 2.2% of TZS amount |
| Speed | M-Pesa arrives in ~10 seconds |
| Network | Vodacom M-Pesa (Tanzania) |
| LNbits Version | v1.5.4 or later |
| Lightning Backend | Any (Blink, LND, CLN, OpenNode, Alby) |
| Step | Action |
|---|---|
| 1 | Open the ChapSmart extension in LNbits, select your wallet |
| 2 | Enter the recipient's Vodacom number (074/075/076), full name, and TZS amount |
| 3 | Click "GET QUOTE" — see exactly how many sats will be deducted |
| 4 | Click "SEND M-PESA" — sats are deducted, M-Pesa arrives in seconds |
/chapsmart/api/v1/:{
"quoteId": "6cqdmAqYu2nsVfPOgm1G",
"amountTzs": 5000,
"amountSats": 2578,
"feeSats": 57,
"expiresAt": "2026-05-17T09:15:00Z"
}| Status | Meaning |
|---|---|
| pending | Quote created, awaiting payment |
| paid | Lightning payment confirmed, M-Pesa processing |
| completed | M-Pesa delivered to recipient |
| failed | Payout failed — contact support |
| Step | Action |
|---|---|
| 1 | In LNbits admin, go to Settings → Extensions → Extension Sources, add:https://raw.githubusercontent.com/bmosha00/lnbits-chapsmart/main/manifest.json |
| 2 | Go to Extensions → ALL tab, find ChapSmart, click INSTALL (v0.0.6) |
| 3 | Configure API credentials (contact support@chapsmart.com to get your keys) |
| 4 | Connect a real Lightning backend (LND, CLN, Blink, etc.) |
Freelancer cashout — Convert sats earned on Nostr/Lightning to M-Pesa
Merchant settlement — BTCPay stores can auto-settle to M-Pesa
Cross-border transfers — Anyone worldwide with Lightning can send TZS to Tanzania
BTCPay Server Plugin
Auto-cashout Bitcoin payments to M-Pesa. When a customer pays a BTCPay invoice, the plugin converts sats to TZS and delivers to your M-Pesa — automatically.
| Detail | Value |
|---|---|
| Trigger | Automatic on invoice settlement, or manual from dashboard |
| Minimum | 2,500 TZS (~$1 USD) |
| Maximum | 1,000,000 TZS (~$390 USD) |
| Fee | Tiered: Bronze 2.20%, Silver 1.87%, Gold 1.32% |
| Speed | M-Pesa arrives in seconds after Lightning settlement |
| Network | Vodacom M-Pesa (Tanzania) |
| BTCPay Version | Latest (Docker deployment) |
| Multi-store | Yes — separate config per store |
| Mode | How It Works |
|---|---|
| Automatic | Plugin watches for settled invoices and triggers cashout automatically. No manual action needed. |
| Manual | Merchant visits the plugin dashboard, enters TZS amount, reviews quote, clicks "Cashout." |
| Step | Action |
|---|---|
| 1 | Customer pays a BTCPay invoice via Lightning |
| 2 | BTCPay confirms settlement, plugin receives event |
| 3 | Plugin gets a live TZS quote from ChapSmart API |
| 4 | Plugin pays the ChapSmart invoice from the store's Lightning wallet |
| 5 | M-Pesa arrives on the merchant's phone — no manual action needed |
E-commerce — WooCommerce + BTCPay settles to M-Pesa after each sale
Tourism — Safari operator accepts Bitcoin from tourists, receives TZS
Freelancers — Invoice clients in Bitcoin via BTCPay, cash out to M-Pesa
Partial cashout — Keep some sats as savings, cash out a portion for expenses
| Method | Steps |
|---|---|
| Plugin Marketplace | BTCPay Dashboard → Manage Plugins → Search "ChapSmart" → Install → Restart |
| Manual (Docker) | Set BTCPAY_EXTRA_PLUGINS=chapsmart-btcpay-plugin in your docker-compose, then restart |
| Build from Source | git clone github.com/bmosha00/chapsmart-btcpay-plugin && dotnet build |
| Setting | Required | Description |
|---|---|---|
| API Key | required | ChapSmart API key |
| API Secret | required | HMAC signing secret |
| Account Number | required | ChapSmart account identifier |
| M-Pesa Phone | required | Merchant's Vodacom number for cashout |
| Recipient Name | required | Name matching M-Pesa registration |
| Auto Cashout | optional | Enable automatic cashout on invoice settlement |
| Min Threshold | optional | Minimum TZS to trigger auto cashout |
| LNbits Extension | BTCPay Plugin | |
|---|---|---|
| For | Individual Lightning users | Merchants accepting Bitcoin |
| Trigger | Manual (user clicks Send) | Automatic on invoice settlement |
| Recipient | Any phone number (per transaction) | Merchant's registered phone |
| Status | v0.0.6 — Production tested | v1.0.0 — Built and packaged |
Support
Need help integrating? Contact our developer support team.