Skip to Content
GuidesMigrating from Daraja

Migrating from Daraja

VectaPay isn’t a wrapper around Daraja that disappears once you outgrow it — it’s a separate platform that also happens to support M-Pesa. If you’re moving an existing raw-Daraja integration over, here’s what changes.

What you stop building yourself

Raw DarajaVectaPay
OAuth token refreshYou manage itHandled for you
Webhook retriesYou build itAutomatic, with backoff — see Webhooks
Duplicate payment preventionYou build itidempotencyKey on the request
Multiple providersSeparate integration per railOne SDK — see Providers
Error handlingSafaricom’s ResultCode per callbackOne FailureCode taxonomy across providers
Amount representationRaw numbers, easy to mis-roundMoney objects, minor units, no floats

What maps to what

Daraja conceptVectaPay equivalent
POST /mpesa/stkpush/v1/processrequestvectapay.payments.collect()
CheckoutRequestIDcheckoutRequestId on the response, still usable with statusByCheckoutRequestId()
STK callback (ResultCode, CallbackMetadata)payment.succeeded / payment.failed webhook, or payments.get()
B2C requestvectapay.payouts.send() — see Sending a Payout
Account balance queryvectapay.payouts.getBalance()

What stays true either way

  • The customer still gets a PIN prompt and still has to act on it — VectaPay doesn’t change that latency or UX, only what you have to build around it.
  • Amount limits (KES 10–150,000 per STK push) are Safaricom’s, not VectaPay’s, and still apply.
  • If you already have a Paybill/Till and Daraja app credentials, connect them as-is in Payment Methods — you don’t need new ones.

If you don’t have your own Daraja credentials

You don’t need to apply for one to accept M-Pesa payments — connecting a Paystack account instead lets you accept M-Pesa (and cards, and bank transfer) with Paystack as the merchant of record. See Paystack.

Testing while you migrate

Daraja’s sandbox test MSISDNs don’t apply here: you don’t configure a sandbox Paybill, and there is no magic test number that auto-confirms. Instead, verify the Safaricom phone you’ll test with under Developer → Testing (one KES 10 prompt), create a pk_test_ key, and send your normal collect() call to that number. The prompt arrives on the real handset and the callback surfaces as a normal signed webhook with environment: "test".

Everything your Daraja callback handler used to parse — ResultCode, CallbackMetadata — is normalised into status and failure.code; keep the raw payload under providerDetails only for support investigations. See Testing for the full flow and the rate limits.

Last updated on