Dev Dave

Dark green M-Pesa and card payment planning cover with a highlighted Payments headline and a verification and order-state checklist

M-Pesa or Card Payments?

By David Topoika — Flutter & backend developerPublished
M-PesaPaymentsAPI IntegrationClient Guide

Choose payment methods around your customers and operations, then choose an integration that supports them. A Kenyan product serving mainly M-Pesa users has a different starting point from a service that also needs card payments from customers abroad. In both cases, the important delivery is a verified, recoverable payment journey connected to the correct order.

I integrated M-Pesa Daraja and Pesapal in my TheCatfish work, alongside a Node.js backend and Flutter client. This guide is for clients planning a new checkout or donation feature. It covers the buying decisions and acceptance examples; the linked implementation guides explain the technical details. The sample booking scenario is illustrative rather than an actual client's transaction history.

Separate the payment method from the integration provider

M-Pesa is a payment method. Safaricom's Daraja developer platform provides APIs for integrating M-Pesa with web and mobile applications. A payment gateway is a different layer: it can make several methods available through its own integration and merchant relationship.

Pesapal's online payment offering describes support for M-Pesa and cards. That means the decision is not simply “M-Pesa or Pesapal.” You may be comparing direct M-Pesa integration with a gateway that can also offer M-Pesa, or considering separate integrations for different customer needs.

Confirm the methods, currencies and account capabilities available to your particular business with the provider. A method appearing in marketing material does not establish that it is enabled for your merchant account or suitable for every transaction your product wants to support.

Answer the customer questions first

Before comparing APIs, describe who is paying and what they are paying for. Are you collecting a donation, selling a service, taking a booking deposit or unlocking a digital feature? Does the customer need to finish immediately, or can staff confirm availability before payment?

Ask which methods customers already expect, whether they pay from Kenya or elsewhere, and what happens after payment. An app with a mostly local audience may start with a narrower method set. A service with overseas customers may need card acceptance, but you still need to verify the provider's merchant and currency arrangements before committing to the scope.

Also name the payer and recipient. Collecting money for your own business differs from moving money on behalf of several independent sellers. Marketplace settlement and payouts need a separate provider and operational discussion; ordinary checkout integration should not silently promise that capability.

Compare the delivery scope

This table is a planning framework, not a provider pricing comparison or a guarantee about a particular merchant account.

QuestionDirect Daraja integrationGateway integration such as Pesapal
Main starting pointA specific M-Pesa workflow your merchant setup supportsThe supported methods enabled through your gateway account
Backend responsibilityImplement the relevant provider requests, confirmation and recovery pathImplement order creation, notification handling and provider status checks
Customer interfaceYour app guides the supported prompt or payment journeyYour app connects the provider-supported checkout and return journey
Operational reviewMerchant references, payment evidence and reconciliationGateway references, method details, payment evidence and reconciliation
Commercial questionsConfirm current account requirements and charges with the providerConfirm current methods, settlement arrangements and charges with the provider

One integration is not automatically cheaper to build or operate. Existing backend work, account readiness, recovery requirements and the supported methods affect the comparison. Ask for an estimate against the same acceptance journey so you can see what each option includes.

Confirm account readiness before scheduling the release

Identify the person who owns the merchant account and can complete provider onboarding. Establish whether the credentials and enabled services are for a test environment or live processing. Record the required callback hosting and who can configure it.

Keep provider approval separate from implementation progress. A developer can prepare an integration and demonstrate agreed test cases while a merchant setup is still incomplete. That does not make the live service available. Name the remaining dependency and who is responsible for resolving it.

Ask the provider directly about current transaction charges, settlement timing, refund handling and method availability. Those details can vary by account and change over time. The development proposal should distinguish implementation cost from recurring provider and hosting costs without inventing a universal rate.

A worked booking example

Imagine a workshop that wants customers to pay a deposit after staff confirm a booking slot. The first decision is when payment becomes available. Taking money before confirming availability creates a different cancellation and support workflow from requesting payment after approval.

An illustrative first journey could be:

  1. A customer submits a booking request and receives its reference.
  2. Staff confirm the slot and the amount the customer should pay.
  3. The customer opens the payment action for that specific booking.
  4. The backend creates or reuses the appropriate payment attempt.
  5. The provider processes the chosen method and the backend verifies the result.
  6. The app displays the current booking and payment state, including an uncertain result.
  7. Staff can investigate the attempt using references without asking for private credentials.

Separate the booking's business status from the payment attempt's status. A confirmed slot can still have an unpaid deposit. A paid deposit does not necessarily mean the service has been completed. Avoid forcing every product decision into a single “success” field.

Make verification part of the scope

Opening a checkout, receiving an initiation response or returning to a success page is not enough to grant value. The backend needs to establish the provider result, connect it to the correct order and check the expected amount and currency where applicable before applying the agreed transition.

For Pesapal API 3.0, the IPN registration documentation describes server notifications, including cases where a customer closes the browser or loses their connection. Its transaction status documentation explains checking the payment using the provider's tracking reference. The return screen and server notification therefore have related but distinct responsibilities.

For a direct Daraja implementation, confirm the appropriate confirmation and verification workflow for the API and merchant setup in use. My Node.js M-Pesa guide walks through STK Push integration, while the Pesapal implementation guide covers that provider's flow. A client brief should require the verification behaviour without prescribing an unreviewed code snippet.

Decide what happens when the result is uncertain

The customer can lose their connection after the provider accepts a request. A confirmation can arrive later than the interface expects. A notification can be repeated. These cases should produce a defined recovery path rather than an automatic second payment attempt.

For the workshop example, the app might show that the deposit is still being checked, retain the existing reference and allow the customer to reopen its status. The backend should handle repeated provider notifications without applying the booking transition twice. An interrupted result needs investigation or reconciliation according to the provider-supported workflow.

Agree what the support team sees and what they may do. A useful dashboard can show the order, relevant payment references and verified state. Giving all staff an unrestricted “mark paid” action is not a substitute for resolving missing provider evidence. See planning an admin dashboard for role and workflow requirements.

Scope the mobile client and backend separately

If a backend team already owns initiation and verification, a Flutter engagement can focus on checkout screens, status display and returning to an existing attempt. It still needs a documented API, test accounts and clear error responses.

If there is no payment backend, include order data, server-side provider access, notification handling and operational checks explicitly in the proposal. Provider secrets belong in the appropriate server environment, not in a distributable mobile app or a public repository.

The Flutter API integration brief helps record that boundary. My payment integration service can cover a mobile connection to an existing backend or a separately agreed backend implementation. The estimate should state which responsibility it covers.

Use acceptance examples that include recovery

Before the release, agree on suitable test cases for the chosen provider and environment. Include the important business outcomes, not just a successful prompt.

  • A valid attempt completes and updates only its intended order.
  • A cancelled or unsuccessful attempt leaves the order in the correct state.
  • A delayed confirmation can be recovered after the customer reopens the app.
  • Repeated notifications do not grant the purchased value more than once.
  • A mismatch between the expected and verified payment is held for the agreed review.
  • A customer cannot inspect another customer's order by changing a reference.
  • Staff can trace a disputed attempt through appropriate references and logs.
  • Refund or reversal handling follows the agreed provider and product process.

Test-environment success does not establish that live credentials, network configuration or merchant methods are ready. Plan a controlled live verification with the authorised account owner and record its scope separately from the sandbox checks. Do not use real customer transactions as casual test fixtures.

A sample integration brief

We operate a booking service in Kenya and need deposits connected to confirmed bookings. We want to evaluate M-Pesa first and card payments if our merchant account supports the required customer and currency needs. Our existing Node.js backend owns bookings, but payment initiation and verification still need work. Please propose a milestone covering one booking from payment attempt to a verified result, including cancellation, delayed confirmation and reopening an uncertain attempt. List merchant-account dependencies, provider costs we must confirm, support responsibilities and exclusions. Seller payouts and subscriptions are outside this release.

This gives you a basis for discussing both implementation and operation. If you need help defining or building that journey, share your payment brief. We can scope the backend, mobile integration and review evidence before treating checkout as complete.

Want help with something similar?

If this article matches a problem you're facing, I can help you scope it and ship it — starting with a quick consultation.

Related Articles

Planning Flutter API Integration
Dark green Flutter API integration cover with a highlighted Flutter headline and a staging API and mobile scope checklist

December 2, 2026

Planning Flutter API Integration

Prepare a Flutter API integration brief with clear backend ownership, authentication rules, sample responses and acceptance examples before hiring a d...

FlutterAPI IntegrationHiringClient Guide
Hiring a Full-Stack Developer
Dark green hiring guide cover with a highlighted Full-Stack headline and a scope, evidence and handover checklist

December 2, 2026

Hiring a Full-Stack Developer

Hiring a freelance full-stack developer? Compare project evidence, define frontend and backend scope, and agree on milestones with a worked client bri...

HiringFull-Stack DevelopmentClient GuideFreelancing
Planning a Business System
Dark green business system planning cover with a highlighted Business System headline and a records, roles, integrations and acceptance checklist

December 2, 2026

Planning a Business System

Hiring a systems developer in Kenya? Scope a custom business system with clear workflows, data ownership, migration, integrations and acceptance examp...

Business SystemsBackendHiringClient Guide

Get In Touch

Let's Work Together

I'm currently open to new opportunities and collaborations. Whether you have a project in mind or just want to say hello, feel free to reach out!

Dev Dave

© 2026 Topoika. All rights reserved.

This site uses cookies to understand how visitors use it and to improve the experience. You can accept or reject analytics cookies at any time — read the privacy note.