MelyqraTech

Payment engineering · Kenya

M-Pesa Daraja API integration for websites, apps and business systems.

Give customers a familiar way to pay while your application receives a reliable record of what happened. Melyqra Tech builds payment workflows around Safaricom Daraja, including STK Push initiation, server-side callback handling and transaction records that your business can reconcile.

We are based in Nairobi and build payment infrastructure as well as business applications. Our Melyqra product demonstrates our work with M-Pesa collections, payment verification, transaction records and developer-facing APIs.

What an M-Pesa integration can connect

STK Push checkout

Allow a customer to start a payment from a website, mobile app or business workflow. The application requests an M-Pesa prompt, the customer confirms with their PIN on their phone, and your backend tracks the result instead of assuming that a prompt means a successful payment.

Payment callbacks and verification

Safaricom sends the result to a callback URL configured for the integration. We design the receiving endpoint to validate the request, handle duplicate or delayed notifications safely, record the outcome and update the matching order or invoice. The customer-facing screen should show a clear pending, successful or failed state.

Transaction records and reconciliation

Store the details your team needs to trace a payment: the internal order or account reference, amount, phone number where appropriate, provider request identifiers, result code and timestamps. This makes it easier to investigate mismatches and reconcile business records.

Paybill, Till and other workflows

Some projects also need customer-initiated Paybill or Buy Goods payments, refunds or disbursements. These are separate workflows with their own Safaricom product access, credentials, callback rules and approval requirements. We confirm the exact shortcode, API products and business process before including them in a project scope; they are not assumed to be enabled by an STK Push integration.

Where businesses use it

  • E-commerce: connect checkout payments to orders and show customers whether payment is confirmed.
  • Booking and reservations: associate a payment with a booking reference and keep the booking status consistent.
  • Subscriptions and digital services: connect payment events to account access according to the agreed billing model.
  • Business applications: link payments to invoices, customer accounts or service requests in an existing system.
  • Custom platforms: expose a controlled payment workflow through an API rather than embedding provider credentials in a browser or mobile app.

How we approach a Daraja integration

  1. Understand the payment journey: map who pays, what they are paying for, the reference that identifies it and what should happen after payment.
  2. Confirm Safaricom access: review the required Daraja app, shortcode, product permissions, callback URLs and sandbox or production credentials.
  3. Build the server-side flow: keep secrets on the server, validate inputs, initiate requests securely and store provider references.
  4. Test failure cases: cover timeouts, cancelled prompts, duplicate callbacks, delayed results, invalid amounts and interrupted connections.
  5. Prepare for launch: verify the production configuration, logging, reconciliation process and handover requirements before going live.

Security and reliability matter

Payment credentials should never be placed in public frontend code. A sound implementation keeps secrets server-side, checks that callbacks belong to the expected transaction, prevents duplicate fulfilment and records enough information to investigate disputes. We also plan for the fact that a customer may close a browser tab while a payment is still processing.

Safaricom controls access to its Daraja APIs, shortcode products and production approvals. We can build and test the integration, but production access and transaction processing remain subject to Safaricom's requirements and the merchant's account.

Questions about M-Pesa integration

Do I need a Paybill or Till number?

It depends on the payment product and workflow. STK Push, Paybill and Buy Goods have different setup requirements. We review the intended flow and confirm what Safaricom account or shortcode access is needed before development begins.

Can you integrate M-Pesa into an existing website or app?

Yes. We first review the current application, backend, order or invoice model and hosting environment. The integration is then designed to fit the existing system rather than requiring a complete rebuild.

Can I test before accepting live payments?

Daraja provides a sandbox for supported products. We use the appropriate test environment first; production use requires the relevant Safaricom approvals and live configuration.

What if a payment prompt is sent but the customer does not complete it?

The application should keep the transaction pending until it receives a verified result or reaches a defined timeout and recovery process. A sent prompt alone must not mark an order as paid.

Build your M-Pesa payment flow

Tell us what your customers need to pay for, which application should receive the confirmation and whether you already have a Safaricom shortcode and Daraja access. We can review the workflow and propose a scoped implementation.

Discuss an M-Pesa integration