Download the plugin
Fortpesa for Easy Digital Downloads v1.0.0 (ZIP)
What you need
- Easy Digital Downloads 3.0+ (2.9+ should also work)
- PHP 7.4+ on your hosting
- Store currency set to KES — the M-Pesa gateway only shows for Kenyan shilling stores
- A Fortpesa account with an approved payment channel
1
Install the plugin
Download the ZIP above, then in WordPress go to Plugins → Add New → Upload
Plugin, choose
fortpesa-for-edd.zip, then Install Now and Activate.2
Set your currency to KES
Go to Downloads → Settings → General and set Currency to
Kenyan Shilling (KES). The Fortpesa gateway only appears at checkout
for KES stores.
3
Get your Fortpesa details
In your Fortpesa dashboard, create an API key under Settings → API keys
and copy it right away — it is shown only once. Then note your
Channel ID from Channels (the Channel ID column on the channels
list).
Keep the API key on your server only — never in client-side code. If you
lose the key, revoke it and create a new one.
4
Configure the gateway
Go to Downloads → Settings → Payment Gateways → Fortpesa (M-Pesa) and
paste your API key, Channel ID (required) and webhook secret (optional but
recommended). Then under Payment Gateways → General, tick
Fortpesa (M-Pesa) in the list of enabled gateways and save.
You can also set the API key and webhook secret as
wp-config.php
constants — FORTPESA_API_KEY and FORTPESA_WEBHOOK_SECRET — which
override whatever is saved on the settings screen.5
Add the webhook
The plugin settings screen shows your Webhook URL — it looks like this:Add that URL under Settings → Webhooks in your Fortpesa dashboard, then
copy the
whsec_… secret it gives you and paste it back into the plugin.6
Test with a small order
Place a small real order (KES 10 or so) and approve the prompt on your phone.
The order should complete and the download should unlock.
There is no sandbox: test with a real payment of KES 1 or more. Keep your
Fortpesa wallet topped up — the platform fee is deducted from it, and
collections fail with
INSUFFICIENT_CREDIT when it is empty.Good to know
- Your customer enters their phone number, gets an STK push, and lands on a “Check your phone” page that reloads itself every 5 seconds until M-Pesa confirms.
- Orders only complete after a fresh status check returns success and the amount matches — the signed webhook (HMAC-SHA256, 5-minute replay window) finishes the job even if the customer closes the browser.
- Cancelled, failed and expired prompts mark the EDD order Failed — the customer can retry from checkout.
- Every API outcome is logged under Downloads → Tools → Logs → Payment Errors (the API key is never logged; phone numbers are masked).
- Order totals with cents are rounded up to whole shillings; references sent
to Fortpesa look like
EDD1234(max 12 characters).
Next steps
- WooCommerce plugin — the same flow for WooCommerce stores
- STK Push API — how the underlying endpoint works
- Webhooks — verify signatures on your own server