A demo app that converts Bitcoin (Lightning) to ZAR and sends it to a South African bank account using the MavaPay API.
- Dashboard shows the live BTC/ZAR exchange rate
- You click "Off-ramp" and enter: amount (sats), bank, account number
- The app verifies the bank account via MavaPay name enquiry
- MavaPay creates a quote and returns a Lightning invoice
- You pay the invoice from any Lightning wallet
- MavaPay converts BTC to ZAR and sends it to the bank account
- The app polls transaction status until complete
No real money is involved -- this uses the MavaPay staging environment.
- Python 3.8+
- A MavaPay account with a staging API key
git clone https://github.com/xyephy/mavapay-offramp.git
cd mavapay-offramppip install -r requirements.txtSandbox (recommended for testing):
- Create an account at https://staging.mavapay.co
- Go to Settings > API Keys & Webhooks
- Copy your Secret Key
Production:
- Create an account at https://mavapay.co/create-account
- Complete account verification
- Go to Settings > API Keys & Webhooks
- Copy your Secret Key
API docs: https://docs.mavapay.co
cp .env.example .envOpen .env and replace your_mavapay_staging_key_here with your actual key:
MAVAPAY_API_KEY=your_actual_staging_key
python app.pyOpen http://127.0.0.1:5002 in your browser.
- The dashboard shows the current BTC/ZAR exchange rate
- Click Off-ramp to Bank
- Enter the amount in satoshis (e.g. 50000)
- Select a bank and enter the account number
- Click Verify to confirm the account holder name
- Click Get Quote to see the exchange rate and fees
- Pay the Lightning invoice shown (QR code or copy the invoice string)
- Wait for MavaPay to process the payout
| Method | Route | Description |
|---|---|---|
| GET | / |
Dashboard with exchange rate |
| GET | /offramp |
Off-ramp form |
| GET | /api/health |
Check MavaPay connectivity |
| GET | /api/price |
Get BTC/ZAR exchange rate |
| GET | /api/banks/<country> |
List banks for a country (ZA, NG, KE) |
| POST | /api/verify_account |
Verify bank account (name enquiry) |
| POST | /api/get_quote |
Create quote, returns Lightning invoice |
| GET | /api/check_payout/<hash> |
Poll payout status |
| GET | /status/<tx_hash> |
Transaction status page |
- Flask -- Python web framework
- MavaPay API -- BTC-to-fiat off-ramp (staging)
- qrcode + Pillow -- QR code generation for Lightning invoices