How It Works
VectaPay sits between your application and three payment rails: M-Pesa (direct Daraja), Airtel Money, and Paystack.
The four SDKs (TypeScript, Python, Java, C#) share this same design — same resource names, same money-as-an-object rule, same failure taxonomy.
The request
You call vectapay.payments.collect() with a phone number, an amount, and a reference. VectaPay
resolves which connected provider account should handle it (you can also target one explicitly
with providerAccountId) and sends a payment prompt to the customer’s phone.
The response
A successful collect() call means the prompt was sent — not that the customer paid. Mobile
money confirmation is asynchronous: the customer still has to open their phone and enter a PIN,
which can take a couple of seconds, or never happen at all if they
ignore it.
There are exactly two ways to find out what happened:
- Webhooks (recommended) — VectaPay calls your server the moment the payment resolves.
- Polling
vectapay.payments.status()— fine for a status page a user is actively looking at, wasteful as your primary mechanism. See Webhooks for a diagram of the full request → prompt → webhook timeline and why polling doesn’t get you the answer any sooner.
One payment shape, one failure taxonomy
Whichever provider handled the payment, the record you read back has the same fields — status,
amount, provider, method — and if it failed, the same closed set of
failure codes. Provider-specific
detail (Safaricom’s CallbackMetadata, Paystack’s gateway response) is still there, but tucked
under providerDetails should you need it for support investigations.
What’s provider-specific today
Not every capability is available on every rail yet:
- Collection (accepting a payment) works across mobile money providers through one endpoint.
- Payouts (sending money out) are M-Pesa/Airtel B2C today.
- Card and bank transfer payments go through Paystack’s hosted checkout — start one with
collect()and anemail, or with a payment link — see Providers for the current capability matrix.