Description
Attesta adds M-Pesa (STK Push / Lipa na M-Pesa) as a WooCommerce payment method, and reconciles every payment automatically so a missed callback never means a lost sale.
How Attesta handles payments:
- Orders are marked paid only against a verified M-Pesa receipt number and a matching amount, not merely because M-Pesa accepted the request.
- Automatic reconciliation: if the payment callback never arrives, Attesta queries M-Pesa directly until it gets a definitive answer.
- Setup validation before you go live: credentials, callback reachability, permalinks, and background processing are all checked up front.
- Your Daraja API credentials never leave your own site and are encrypted at rest.
- Kenya Data Protection Act (2019) aware: phone numbers are hashed/masked, never stored in the clear.
Free vs Pro
Free (this plugin, forever):
- STK Push (Lipa na M-Pesa) with Pay Bill and Till.
- Payments confirmed against a real M-Pesa receipt and matching amount, never on “request accepted”.
- Automatic reconciliation: if the callback never arrives, Attesta queries M-Pesa until it gets a definitive answer.
- Payment recovery when STK fails: the Pay Bill and reference are shown, and the manual payment is matched automatically.
- Setup validation before going live (credentials, callback reachability, permalinks, background processing).
- Transactions ledger with the M-Pesa receipt stored.
- Daraja credentials encrypted in the merchant’s own database.
- One shortcode, one site.
Pro:
- Payment links: get paid over WhatsApp, SMS or an invoice, with no online store.
- C2B account references per customer, tenant or student.
- Standalone cash dashboard, with no WooCommerce required.
- Multiple shortcodes or branches in one installation.
Requirements
- A Safaricom Daraja account and a Paybill or Till number, registered in your own business’s name (M-Pesa integrations must be registered to the business actually receiving the funds. This is a Central Bank of Kenya compliance requirement, not a restriction Attesta invents).
- WooCommerce, for the checkout payment method. Attesta activates and runs without it, but the payment method it adds is a WooCommerce one, so taking payments at a store checkout needs WooCommerce installed.
- Pretty permalinks. M-Pesa cannot reach the confirmation URL with permalinks set to Plain, and the setup check will tell you so.
External services
Attesta connects to one external service: the Safaricom Daraja API (M-Pesa), operated by Safaricom PLC. Without it the plugin cannot take M-Pesa payments. Requests go to https://sandbox.safaricom.co.ke in Sandbox mode and to https://api.safaricom.co.ke in Production mode, using the merchant’s own Daraja credentials. Nothing is sent to Honest Plugins or to any other party.
What is sent, and when:
- Access token request: your Daraja Consumer Key and Consumer Secret. Sent before any of the calls below, and when you run the setup check.
- STK Push (payment request): your shortcode, a password derived from your passkey, the amount, the customer’s phone number, the order reference, a short description and your site’s callback URL. Sent when a customer places an order with M-Pesa as the payment method.
- STK Push query (reconciliation): your shortcode, the password derived from your passkey, and the ID that M-Pesa gave the pending payment. Sent automatically in the background while a payment is still pending and its callback has not arrived.
- C2B URL registration: your shortcode and your site’s confirmation and validation URLs. Sent only when you press the button to register them in Attesta Settings.
Safaricom then sends the payment result back to your site’s callback URL.
Safaricom Daraja terms and conditions: https://developer.safaricom.co.ke/terms
Safaricom data privacy statement: https://www.safaricom.co.ke/dataprivacystatement/
Screenshots



Installation
- Install and activate WooCommerce, if you want to take payments at a store checkout.
- Upload and activate Attesta.
- Go to Attesta Settings and enter your Daraja Consumer Key, Consumer Secret, Passkey and Shortcode.
- Run the built-in setup check before switching from Sandbox to Production.
- Switch M-Pesa on at your checkout: press “Show M-Pesa at checkout” on Attesta Settings, or enable it under WooCommerce Settings Payments.
FAQ
-
Does Attesta ever hold my customers’ money?
-
No. Attesta talks directly to Safaricom’s Daraja API using your own credentials. Funds move directly between your customer and your Paybill/Till; nothing passes through Attesta or Honest Plugins.
-
Why does my order stay “On hold” after the customer pays?
-
The order moves to Processing/Completed automatically once Attesta confirms a real M-Pesa receipt, either via the instant callback, or via the automatic reconciliation check if the callback is delayed. This is deliberate: it’s what prevents an order being marked paid on a request that was merely accepted, not completed.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Attesta Payments for M-Pesa” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Attesta Payments for M-Pesa” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.0.1
This release only opens doors for add-ons. On its own the plugin behaves exactly as 1.0.0 did.
- Add-ons can stop a payment before the M-Pesa prompt is sent, through the new
attesta_pre_stk_for_orderfilter. - Refund hooks: the gateway now answers WooCommerce’s refund question and exposes
attesta_gateway_supports_refundsandattesta_process_refund. Without an add-on, refunds stay switched off and WooCommerce shows no automatic refund button, the same as before. - Daraja requests made by add-ons can set their own timeout, so a check that runs while the customer waits at the checkout does not hold the page for twenty seconds.
1.0.0
- First release.
- M-Pesa (Lipa na M-Pesa / STK Push) as a WooCommerce payment method, for both Pay Bill and Till accounts.
- Orders are marked paid only against a verified M-Pesa receipt and a matching amount.
- The customer types the M-Pesa number that should get the payment prompt, in both the classic and the block checkout, prefilled from the billing phone.
- M-Pesa is offered at checkout only once the Daraja credentials are in place, and Attesta Settings tells you whether customers can see it, with a button to switch it on.
- Automatic reconciliation when the payment callback does not arrive.
- If M-Pesa still has not confirmed a payment after about 30 hours, the order gets a note saying what to check in your M-Pesa statement, and an admin notice points you to it.
- Manual-payment recovery: the Pay Bill and reference are shown when the STK prompt fails, and the payment is matched automatically.
- Internal: the STK Push request for an order and the settling of an unmatched payment are now reusable functions, with the checkout behaving exactly as before.
- Setup check for credentials, callback reachability, permalinks and background processing.
- C2B callback URL registration, with safeguards for the one-time nature of the call in production.
- Transactions ledger with the M-Pesa receipt stored, shown in order notes, customer emails and the admin order screen.
- Diagnostics written to the WooCommerce log, plus a downloadable support bundle containing no credentials and no personal data.
- Attesta section in WooCommerce Status.
- Compatible with High-Performance Order Storage and the block-based checkout.
