BTCPay Server plugin for automatic Bitcoin-to-Mobile-Money payouts. When a BTCPay invoice is paid (Lightning, on-chain, or altcoin), the plugin triggers an instant mobile money payout to the recipient. Built for Africa's mobile money ecosystem.
# ChapSmart Cashout — BTCPay Server Plugin
Convert your Bitcoin earnings to Tanzanian Shillings (TZS) and receive them directly on M-Pesa. Automatically.
## How It Works
1. A customer pays a BTCPay invoice on your server (Lightning or on-chain)
2. The plugin catches the invoice settlement
3. Plugin calls ChapSmart's cashout API with your Merchant ID and the TZS amount
4. ChapSmart returns a Lightning invoice — the plugin pays it from your wallet
5. ChapSmart receives the BTC and sends TZS to your registered M-Pesa number
6. You get an M-Pesa notification. Done.
The plugin's job ends at step 4. ChapSmart handles everything after that.
## Requirements
- BTCPay Server v2.0.1 or later
- Lightning Network enabled on your BTCPay store
- A ChapSmart Merchant ID (register at chapsmart.com)
## Installation
### From Source
```bash
git clone --recurse-submodules
github.com
cd chapsmart-btcpay-plugin
dotnet publish BTCPayServer.Plugins.ChapSmart -c Release
```
Copy the DLL from `BTCPayServer.Plugins.ChapSmart/bin/Release/net8.0/publish/` to your BTCPay Server's plugin directory.
### Manual Deploy (Docker)
```bash
docker cp BTCPayServer.Plugins.ChapSmart.dll \
btcpayserver:/root/.btcpayserver/Plugins/BTCPayServer.Plugins.ChapSmart/
docker restart btcpayserver
```
## Configuration
After installation, go to **Store → Plugins → ChapSmart** in your BTCPay dashboard.
| Setting | Description | Default |
|---------|-------------|---------|
| **Enable** | Turn cashout on/off for this store | Off |
| **Auto Cashout** | Automatically cash out every settled invoice with `amountTZS` metadata | On |
| **Merchant ID** | Your ChapSmart merchant ID (`mch_xxx`) | — |
| **Min Cashout** | Skip invoices below this TZS amount | 2,500 |
| **API URL** | ChapSmart backend URL (only change for testing) | `
api.chapsmart.com` |
No API keys or secrets needed. The Merchant ID is your only credential.
## Invoice Metadata
For the plugin to …