Skip to content
Phone, payment card and five physical symbols showing checkout, confirmation, settlement, refund and support

M-Pesa and Card Checkouts: Design Every Payment State

Avidni Editorial Team / Commerce8 min read.

A practical checkout guide for Kenyan retailers that connects customer messages with payment requests, callbacks, settlement, refunds, reconciliation and a support path when the happy route breaks.

A payment prompt is not a completed order

The customer taps Pay. A phone prompt appears. They enter a PIN. The browser waits. Somewhere else, a payment provider sends a result to a server. The store creates or updates an order, finance later sees a settlement, and support may receive a screenshot if any part of that chain feels uncertain. Checkout trust is built by connecting those moments, not by painting the Pay button green.

The Safaricom Daraja developer portal exposes the APIs used for M-Pesa integrations. Card gateways use their own request and notification models. In both cases, the public interface should report only the state the store can verify, while the server treats provider callbacks or webhooks as untrusted messages that must be authenticated, recorded and handled safely.

Map the states before drawing the checkout

A customer and operations view of the payment journey
StateWhat the customer should seeWhat the system and team must do
ReadyTotal cost, delivery terms, chosen method and a clear Pay actionCreate a priced order draft and validate stock, address and contact data
Request sentA calm instruction to complete the prompt and avoid repeating the actionStore the provider request reference and prevent duplicate submissions
Customer action requiredHow to find or retry the prompt without losing the orderKeep the order pending and offer a controlled retry
ConfirmingA truthful pending message, not an invented success screenWait for verified provider evidence or query status when supported
PaidReceipt reference, order status and next fulfilment stepMark the order once, trigger fulfilment once and record an audit event
Declined or cancelledA plain reason where safe and another payment optionKeep the basket recoverable and avoid exposing provider internals
Unknown or delayedThe order reference and a support routeQueue reconciliation, avoid duplicate fulfilment and notify staff when needed
Refund requestedWhat was requested and the expected communication pathCheck eligibility, approval and the original payment reference
RefundedAmount, method, reference and support contactRecord the provider result and reconcile it with the order and settlement

Callbacks must be safe to receive twice

Networks retry. Providers retry. Customers double-tap. A reliable payment handler assumes the same event may arrive more than once. It records a stable provider reference, verifies the notification, checks whether the transition already happened and makes the update idempotent. That means a repeated success callback does not create a second order, send a second fulfilment request or reduce stock twice.

Paystack's official webhook guidance recommends verifying event origins and returning a successful response promptly, then performing longer work outside the immediate response where appropriate. The exact verification method depends on the chosen provider, but the design principle is consistent: never trust a browser redirect alone as proof of payment.

Separate payment, order and settlement

These records are related but not identical. A payment can succeed while order creation fails. An order can be cancelled after a successful payment. A settlement can group many transactions and deduct fees. Finance needs a reconciliation view that can match store orders, provider transactions, refunds, fees and settlement deposits without relying on screenshots from customers.

Refunds need a product flow too

A refund button is the end of a decision, not the beginning. The operating rule should cover who may request, approve and execute a refund; whether partial refunds are allowed; what evidence is required; how the customer is updated; and how the order, inventory, provider record and accounting record change. Reversal and refund capabilities differ by provider and transaction state, so the interface must use the language of the implemented method rather than promising an instant outcome.

Test the awkward paths on purpose

A credible E-commerce Experience connects the interface to these operating states. The customer gets clear language, staff get an exception queue, and finance gets records that can be reconciled. That is what payment confidence looks like when the banner image is removed.

Plan a Trustworthy Checkout

Build the website or system your next stage needs.

Strategy, Delivery and Ownership in one accountable process.

Bring the brief, the challenge or simply the outcome you need. Avidni will shape it into a clear delivery plan for a business website, e-commerce store, client portal or automated workflow. You will know what is being built, who owns each decision and what happens after launch, with ongoing care available where it adds real value.

Start a Project