Introduction
What is Sanwo?
Section titled “What is Sanwo?”Sanwo (Yoruba: “to pay”) is a free, open-source payment SDK that gives you a single, unified API for every payment provider on every platform. It is licensed under Apache-2.0 — no fees, no accounts, no strings attached.
The problem
Section titled “The problem”Every payment provider ships its own SDK with its own API surface, its own configuration format, and its own quirks. Integrating one is fine. Integrating three across web and mobile is a nightmare. Swapping providers means rewriting your checkout flow.
Sanwo fixes this. You write your payment code once. When you want to switch from Paystack to Flutterwave, you change a single import.
Supported providers
Section titled “Supported providers”| Provider | Package |
|---|---|
| Paystack | @sanwohq/paystack |
| Flutterwave | @sanwohq/flutterwave |
| Razorpay | @sanwohq/razorpay |
| Monnify | @sanwohq/monnify |
| Interswitch | @sanwohq/interswitch |
More providers are coming. Open an issue to request one.
Supported platforms
Section titled “Supported platforms”| Platform | Package |
|---|---|
| Web / JavaScript | @sanwohq/web |
| React | @sanwohq/react |
| React Native | @sanwohq/react-native |
| Flutter | sanwo_flutter |
| iOS / Swift | Swift Package Manager |
| Android / Kotlin | JitPack |
Key concepts
Section titled “Key concepts”Sanwo’s API has three core types:
Provider
Section titled “Provider”A provider defines which payment gateway to use. You import one and pass it to Sanwo at initialization.
import { paystack } from "@sanwohq/paystack";CheckoutOptions
Section titled “CheckoutOptions”CheckoutOptions describes what to charge. The shape is identical across every provider.
const options = { amount: 500000, // minor units (e.g. 5000.00 NGN = 500000 kobo) currency: "NGN", customer: { email: "customer@example.com" }, reference: "order_abc123",};CheckoutResult
Section titled “CheckoutResult”CheckoutResult is a discriminated union on status that tells you what happened.
type CheckoutResult = | { status: "successful"; reference: string; providerResponse: unknown } | { status: "cancelled" } | { status: "failed"; error: string } | { status: "pending"; reference: string };How it works
Section titled “How it works”- You pass a provider and checkout options to Sanwo.
- Sanwo renders the provider’s checkout UI inside an iframe (web) or webview (mobile).
- Sanwo handles all bridge communication between your app and the provider’s UI.
- When the customer completes (or cancels) payment, Sanwo returns a typed
CheckoutResult.
No lock-in
Section titled “No lock-in”Sanwo is a thin orchestration layer. Payments flow directly from your customer to the payment provider. Sanwo never touches your money. Your provider dashboard, webhooks, and settlement process stay exactly the same.