Documentation
Learn how to integrate M-Pesa into your funnels and stores.
Install the App
Find FedhaBridge on the App Marketplace and click "Install".
Grant the necessary permissions for the app to manage payments and orders in your account.
The dashboard uses your active FedhaBridge account as the initial link destination. After GHL redirects you back, you can choose any organization account you have access to before confirming the connection. Keep the same FedhaBridge session open while completing this step. Existing account/location links cannot be reassigned from this flow.
The dashboard's Reconnect action first refreshes the saved OAuth token. If GHL requires authorization again, the active account is preselected and you can choose a different accessible account on the linking screen.
If you cancel on the FedhaBridge linking screen, no new OAuth tokens are saved and existing connection data is left unchanged, but GHL may already have completed the installation. To remove the app completely, uninstall FedhaBridge from the location's installed apps in GHL. HighLevel documents an AppUninstall webhook, but not an API for the app to uninstall itself.
Configure M-Pesa Credentials
Navigate to the Admin Portal within the app.
Enter your Safaricom Daraja API details:
- Consumer Key & Secret
- Passkey
- Shortcode (Paybill or Buy Goods)
Note: We support both Sandbox (Testing) and Production (Live) modes. Ensure you toggle the correct mode in the configuration.
Add to Checkout
In your Funnel or Store, the M-Pesa payment option will now appear automatically if you have registered it as a custom payment provider.
When a customer selects M-Pesa, they will be prompted to enter their phone number. An STK Push will be sent immediately to their device.
Programmatic Checkout Forms
Use a Checkout Form when your ecommerce server already has a cart and needs to create a payment from its trusted order total. Create the form once with a secret API key, then reference its ID from your server for each order. The form controls the permitted currency, amount bounds, and enabled providers.
sk_ key in browser JavaScript or trust an amount supplied by the customer's browser.1. Create a Checkout Form
curl -X POST "$FEDHABRIDGE_API/api/v1/forms" \
-H "Authorization: Bearer $FEDHABRIDGE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Store Checkout",
"type": "checkout",
"slug": "store-checkout",
"config": {
"type": "checkout",
"amount": {
"mode": "custom",
"currency": "KES",
"min": 100,
"max": 50000,
"presets": [],
"default": 0,
"coverFees": {
"enabled": false,
"defaultChecked": false,
"feePercentage": 0,
"fixedFee": 0
}
},
"defaultMethod": "mpesa",
"methods": [
{ "providerId": "mpesa", "enabled": true, "isDefault": true }
]
}
}'Save the returned id as your Checkout Form ID. The provider must be enabled and have a verified connection on the FedhaBridge account.
2. Create an order payment on your server
curl -X POST "$FEDHABRIDGE_API/api/v1/payment_intents" \
-H "Authorization: Bearer $FEDHABRIDGE_SECRET_KEY" \
-H "Idempotency-Key: order-4821-payment" \
-H "Content-Type: application/json" \
-d '{
"form_id": "YOUR_CHECKOUT_FORM_ID",
"amount": 2450,
"currency": "KES",
"provider": "mpesa",
"customer": {
"name": "Jane Doe",
"email": "jane@example.com",
"phone": "254712345678"
},
"metadata": {
"order_id": "4821"
}
}'FedhaBridge checks the form belongs to the API-key account, is published and has type checkout, then validates currency, amount bounds, and provider. The form ID and slug are attached to the payment metadata. Use a unique idempotency key per order payment attempt.
3. Confirm and verify payment
curl -X POST "$FEDHABRIDGE_API/api/v1/payment_intents/INTENT_ID/confirm" \
-H "Authorization: Bearer $FEDHABRIDGE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{}'
curl "$FEDHABRIDGE_API/api/v1/payment_intents/INTENT_ID" \
-H "Authorization: Bearer $FEDHABRIDGE_SECRET_KEY"Fulfil an order only after the intent status is succeeded or captured, verified server-to-server or from a verified webhook. A browser redirect or a pending status is not proof of payment.
API routes: POST /api/v1/forms (create), POST /api/v1/payment_intents(create payment), POST /api/v1/payment_intents/:id/confirm (start payment), and GET /api/v1/payment_intents/:id (check status). Requests require a secret key using a secret API key. Keep those requests on your server.
Support
Need help? Our technical team is available to assist you with integration and troubleshooting.
Email: info@fedhabridge.com