Learn how to accept payments and send payouts with the Snippe API through simple, copy-paste-ready examples.
Snippe is a payment processing API for businesses in Tanzania. It lets you:
- Collect payments via Mobile Money (Airtel, M-Pesa, Mixx by Yas, Halotel), Cards (Visa, Mastercard), and Dynamic QR codes
- Send payouts to Mobile Money accounts and 40+ Tanzanian bank accounts
- Track everything with webhooks, status checks, and balance queries
Each file in this repo is a standalone snippet you can copy, paste, and run. No setup, no dependencies between files.
Pick your language, pick a topic, and open the file:
| Language | Folder | What You Need |
|---|---|---|
| Node.js | node/ |
Node 18+ (uses native fetch) |
| Python | python/ |
Python 3.7+ with requests (pip install requests) |
| Go | golang/ |
Go 1.18+ (standard library only) |
| cURL | curl/ |
Any terminal |
Each language folder is split into two sections:
<language>/
collection/ Accepting payments from customers
disbursement/ Sending money to recipients
Collection covers the full payment lifecycle: creating payments (mobile money, card, QR), checking status, listing transactions, triggering USSD pushes, checking your balance, searching payments, handling webhooks, and error handling.
Disbursement covers the payout lifecycle: sending to mobile money, sending to bank accounts, listing payouts, checking payout status, calculating fees, handling webhooks, and error handling.
- Create an account at snippe.sh
- Go to Settings > API Keys and create a key
- Replace
snp_your_api_key_herein any snippet with your actual key - Run the file
Your API key is shown only once. Store it somewhere safe.
Files are numbered in the order you'd follow in a real integration:
Collection -- start by accepting a payment, then manage it:
| # | File | What It Does |
|---|---|---|
| 01 | 01-mobile-money |
Accept a Mobile Money payment (USSD push) |
| 02 | 02-card-payment |
Accept a Card payment (redirect to checkout) |
| 03 | 03-dynamic-qr |
Accept a QR code payment (customer scans) |
| 04 | 04-list-payments |
List all your payments with pagination |
| 05 | 05-get-payment-status |
Check the status of a specific payment |
| 06 | 06-trigger-push |
Retry a USSD push for a pending payment |
| 07 | 07-get-balance |
Check your account balance |
| 08 | 08-search-payments |
Search for a payment by reference |
| 09 | 09-webhook-handler |
Receive real-time payment/payout notifications |
| 10 | 10-error-handling |
Handle API errors gracefully |
Disbursement -- send money out:
| # | File | What It Does |
|---|---|---|
| 01 | 01-mobile-money-payout |
Send money to a Mobile Money account |
| 02 | 02-bank-transfer-payout |
Send money to a bank account |
| 03 | 03-list-payouts |
List all your payouts with pagination |
| 04 | 04-get-payout-status |
Check the status of a specific payout |
| 05 | 05-calculate-payout-fee |
Calculate fees before sending a payout |
| 06 | 06-webhook-handler |
Receive real-time payout notifications |
| 07 | 07-error-handling |
Handle payout errors (insufficient balance, etc.) |
Accept a Mobile Money payment in 5 lines (Node.js):
const response = await fetch("https://api.snippe.sh/v1/payments", {
method: "POST",
headers: {
Authorization: "Bearer snp_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
payment_type: "mobile",
details: { amount: 1000, currency: "TZS" },
phone_number: "255781000000",
}),
});The customer gets a USSD push on their phone. They confirm. You get a webhook. Done.