https://fortpesa.co.ke/pay/{uuid}; the widget just frames it and
tells your page when the payment succeeds.
Before you start
- Create a payment link in the dashboard (sidebar Payment links) — fixed amount or open amount.
- Copy its UUID from the link detail page. The shared URL looks like
https://fortpesa.co.ke/pay/9k3f2x.... - Make sure the link is active and your merchant account has an approved channel.
Modal button
The script is a single static file — no build step, no npm.Fortpesa.pay() opens the payment in a modal, returns a Promise, and rejects with
Payment modal closed by user if the customer dismisses it.
Inline iframe
No script needed:Embed parameters
Events (embed mode)
In embed mode the payment page posts messages to the parent window:Verify the payment server-side
The success message is a UI hint, not proof. Before you deliver goods or mark an order paid, confirm the transaction with the API (GET /api/v1/transactions/{uuid}) or wait for the signed
webhook. Both are covered in Transaction status and
Webhooks.
Notes
- The widget needs no API key in the browser — the UUID is the only identifier.
X-Frame-Optionsis removed on/pay/*andframe-ancestors *is sent, so framing works on any site. Everything else in the app stays unframeable.- The hosted link without
?embed=1remains available as a plain page you can share on WhatsApp or by SMS.