Paystack
Provider ID: paystack
Paystack is the default choice for businesses in Nigeria, Ghana, South Africa, and Kenya. It accepts minor units natively (kobo, pesewas, cents), so Sanwo passes your amount through without conversion.
Installation
Section titled “Installation”npm i @sanwohq/paystackflutter pub add sanwo_paystackIn Xcode, go to File > Add Package Dependencies and add:
https://github.com/Sanwohq/iosSelect the SanwoPaystack product.
Add JitPack to settings.gradle.kts:
dependencyResolutionManagement { repositories { maven { url = uri("https://jitpack.io") } }}Then add the dependency in build.gradle.kts:
implementation("com.github.Sanwohq.android:sanwo-paystack:1.0.0")import { paystack } from "@sanwohq/paystack";
const provider = paystack({ publicKey: "pk_test_xxxxxxxxxxxx" });Test keys start with pk_test_. Get yours from the Paystack Dashboard.
Amount handling
Section titled “Amount handling”Paystack uses minor units natively. Sanwo passes values straight through.
| You pass | Paystack receives | Meaning |
|---|---|---|
500000 |
500000 |
5,000.00 NGN (kobo) |
100 |
100 |
1.00 NGN |
Supported currencies
Section titled “Supported currencies”NGN, GHS, ZAR, USD, KES
Supported countries
Section titled “Supported countries”NG, GH, ZA, US, KE
Payment methods
Section titled “Payment methods”card, bank, ussd, qr, mobile_money, bank_transfer, eft
Provider-specific options
Section titled “Provider-specific options”Pass these via sanwoProviderOptions on web/React, or as flat fields on Flutter and mobile SDKs.
| Option | Type | Description |
|---|---|---|
channels |
string[] |
Restrict to specific payment channels (e.g. ["card", "bank_transfer"]) |
label |
string |
Custom title on the checkout page |
plan |
string |
Subscription plan code |
quantity |
number |
Quantity for subscription plans |
subaccount |
string |
Subaccount code for split payments |
splitCode |
string |
Transaction split group code |
split |
object |
Inline split config (see below) |
transactionCharge |
number |
Flat fee in kobo charged on a split |
invoiceLimit |
number |
Maximum number of charges for a subscription |
method |
string |
"checkout" (default) or "newTransaction" (inline) |
Inline split config
Section titled “Inline split config”{ type: "percentage", // or "flat" bearer_type: "account", // or "subaccount", "all-proportional", "all" subaccounts: [ { subaccount: "ACCT_xxx", share: 30 }, { subaccount: "ACCT_yyy", share: 20 }, ]}Usage examples
Section titled “Usage examples”Restrict payment channels
Section titled “Restrict payment channels”Only show card and bank transfer options:
const result = await checkout({ amount: 500000, currency: "NGN", customer: { email: "customer@example.com" }, sanwoProviderOptions: { channels: ["card", "bank_transfer"], },});final result = await sanwo.checkout( CheckoutOptions( amount: 500000, currency: 'NGN', customer: Customer(email: 'customer@example.com'), channels: ['card', 'bank_transfer'], ),);Subscription billing
Section titled “Subscription billing”const result = await checkout({ amount: 500000, currency: "NGN", customer: { email: "customer@example.com" }, sanwoProviderOptions: { plan: "PLN_xxxxxxxxxxxx", quantity: 1, invoiceLimit: 12, },});Split payments
Section titled “Split payments”const result = await checkout({ amount: 500000, currency: "NGN", customer: { email: "customer@example.com" }, sanwoProviderOptions: { subaccount: "ACCT_xxxxxxxxxxxx", transactionCharge: 5000, // 50 NGN flat fee },});