Mobile money in Next.js
App Router route handlers for every provider: payments started on the server, callbacks and webhooks confirmed with the provider before anything is marked paid, reconcile routes behind a secret, and payouts that are never sent twice.
Every guide's code was run in a fresh Next.js project with its tests passing. Other stacks: Node.js, Laravel, Django.
Take payments
Airtel Money
- Airtel Money Collections API in Next.js App Router: USSD PushAccept Airtel Money in a Next.js App Router app: USSD push from a route handler, callbacks confirmed by the status API, safe TIP and TA handling, and tests.
Flutterwave
- Flutterwave Webhooks in Next.js App Router: verif-hash and VerifyReceive Flutterwave v3 webhooks in a Next.js App Router route handler: check verif-hash, verify the transaction by id, and settle each payment once. Tested.
M-Pesa
- M-Pesa STK Push in Next.js App Router: Daraja with Route HandlersAccept M-Pesa in a Next.js App Router app: STK push from a route handler, callbacks confirmed by STK query, 1037 handling, a reconcile cron and tests.
MTN MoMo
- MTN MoMo Collections API in Next.js App Router: Request to PayAccept MTN Mobile Money in a Next.js App Router app: Request to Pay from a route handler, callbacks confirmed by the status API, a reconcile cron and tests.
Paystack
- Paystack Webhooks in Next.js App Router: Verify x-paystack-signatureReceive Paystack webhooks in a Next.js App Router route handler: check x-paystack-signature on the raw body, verify the payment, and settle it once. Tested.
Pesapal
- Pesapal API 3.0 in Next.js App Router: Orders, IPN and StatusAccept M-Pesa, MTN and card payments through Pesapal API 3.0 in a Next.js App Router app: orders, the IPN route, settling from GetTransactionStatus, tests.
Send payouts
Refunds, seller and driver payouts. Comparing the APIs first? See mobile money payouts.
M-Pesa
- M-Pesa B2C in Next.js App Router: Payouts That Never Pay TwiceSend M-Pesa B2C payouts from a Next.js App Router app: SecurityCredential, an admin payout route, ResultURL and timeout routes, and no double payments. Tested.
MTN MoMo
- MTN MoMo Disbursements in Next.js App Router: Safe PayoutsSend MTN MoMo payouts from a Next.js App Router app: an admin transfer route, status checks, a balance check and payouts never sent twice.
Before you choose
- Payment API ChooserFive questions about your business, and which API fits.
- MTN MoMo API vs Flutterwave vs Paystack: Which Should You Use?Compare MTN MoMo, Flutterwave and Paystack for mobile money: countries, sign-up, payment flow, webhook security, status checks and payouts.