Skip to content

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.

Terminal window
npm i @sanwohq/paystack
import { paystack } from "@sanwohq/paystack";
const provider = paystack({ publicKey: "pk_test_xxxxxxxxxxxx" });

Test keys start with pk_test_. Get yours from the Paystack Dashboard.

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

NGN, GHS, ZAR, USD, KES

NG, GH, ZA, US, KE

card, bank, ussd, qr, mobile_money, bank_transfer, eft

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)
{
type: "percentage", // or "flat"
bearer_type: "account", // or "subaccount", "all-proportional", "all"
subaccounts: [
{ subaccount: "ACCT_xxx", share: 30 },
{ subaccount: "ACCT_yyy", share: 20 },
]
}

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"],
},
});
const result = await checkout({
amount: 500000,
currency: "NGN",
customer: { email: "customer@example.com" },
sanwoProviderOptions: {
plan: "PLN_xxxxxxxxxxxx",
quantity: 1,
invoiceLimit: 12,
},
});
const result = await checkout({
amount: 500000,
currency: "NGN",
customer: { email: "customer@example.com" },
sanwoProviderOptions: {
subaccount: "ACCT_xxxxxxxxxxxx",
transactionCharge: 5000, // 50 NGN flat fee
},
});