n8n is an open-source workflow automation tool that allows you to build custom integrations between apps using webhooks, APIs, and visual logic. While ClickPesa does not offer a direct integration with n8n, you can easily connect the two by using ClickPesa webhooks as the trigger for your n8n workflows.
This guide explains how to:
- Receive ClickPesa payment notifications in n8n
- Extract and process payment data
- Update external systems like accounting tools, or databases
Step 1: Set Up a Webhook Node in n8n
- Log in to your n8n instance
- Create a new workflow
- Add a Webhook node as the first node
- Set the HTTP Method to POST
- Choose a unique path, like
/clickpesa-webhook
- Save and activate the workflow
- Copy the webhook URL and add it to your ClickPesa webhook settings
Step 2: Test the Webhook
- Trigger a test payment using ClickPesa (either live or sandbox mode)
- In n8n, ensure that your workflow is set to “Listen for request”
- Once the payment is received, the webhook node will capture a payload with fields like:
orderReference
controlNumber
amountPaid
status
Step 3: Process the Data with Logic Nodes
After the webhook, you can use various n8n nodes to process the payment:
- IF Node: Check if
status
equalsfulfilled
- Switch Node: Branch logic based on full or partial payments
- Set Node: Format data to be used in other systems
Step 4: Connect to External Systems
You can now push the payment data to your destination of choice:
- PostgreSQL / MySQL
- Use the “Execute Query” node to update records in your database
- Send Email / Slack
- Notify your finance or support team of received payments
Optional: Logging & Error Handling
- Use a “Write to File” node to log every webhook event to disk or cloud storage
- Add “Error Trigger” nodes to send alerts if a matching invoice is not found or if payment fails
Summary
- Use n8n’s webhook node to capture ClickPesa payment notifications
- Parse and validate the payment data
- Automate updates to invoices, databases, or other systems
- Customize logic to handle full, partial, or failed payments
Using n8n with ClickPesa gives you full control over your reconciliation workflows, whether you’re updating spreadsheets, accounting software, or custom systems.
Need help creating your n8n workflow? ClickPesa can provide workflow templates and technical support to get you started quickly.