Switch to English?
Yes
Переключитись на українську?
Так
Переключиться на русскую?
Да
Przełączyć się na polską?
Tak

Development of the WayForPay payment gateway on n8n for a Telegram bot

Goal:
Create a fully autonomous subscription management system for a Telegram bot. The key requirement is integration with the Ukrainian payment service WayForPay for automatic invoicing and access activation after payment. The system must reliably track subscription statuses, update user data in Google Sheets, and meet the strict security requirements of the WayForPay API.

My Contribution:
The project started with a fundamental technical problem: standard no-code platforms, such as Make.com, lack built-in tools for generating and validating HMAC-MD5 cryptographic signatures, which are mandatory for working with WayForPay. This made direct integration impossible.

My contribution was to develop a new architecture from scratch on self-hosted n8n, which completely addressed this issue. I designed a robust two-component system, separating the logic of invoice creation and payment processing into two distinct but closely integrated workflows, ensuring maximum stability and ease of debugging.

Solution:
The final solution consists of two optimized workflows in n8n that provide a complete payment processing cycle.

Workflow 1: Invoice Creation
At the heart of this process is a chain of Crypto and Code nodes.

Request Preparation: Using the Code node, a perfectly structured JSON request body is dynamically formed, ensuring the correctness of data types (numbers, arrays) required by the API.

Signature Generation: The Crypto node creates a unique HMAC-MD5 signature for the outgoing request.

Invoice Creation: The final HTTP Request sends the signed request to WayForPay, receiving a unique payment link (invoiceUrl) in response, which is immediately sent to the user in Telegram.

Workflow 2: Payment Processing and Validation
This workflow is triggered via Webhook after successful payment by the client.

Data Parsing: The first Code node proved critical for "unpacking" the data, as WayForPay sent the webhook in an unexpected x-www-form-urlencoded format.

Security Check: The Crypto -> IF chain performs the most crucial function — it recreates the HMAC-MD5 signature from the received data and compares it with the signature from WayForPay. The process continues only if there is a complete match and the status is Approved.

System Update: In case of successful validation, the Google Sheets node updates the user's subscription status, sets a new expiration date, and resets usage counters. The user receives an instant notification in Telegram.

Transaction Completion: The final chain of nodes generates another signature and sends the correct response to WayForPay via Respond to Webhook, confirming the successful receipt of the webhook.

Result:
Successfully developed and implemented an autonomous payment system that fully automated the subscription management process in the Telegram bot. The client received a reliable and secure workflow that operates 24/7 and guarantees:

Reliable integration with the complex API of the WayForPay payment service.

Complete security through cryptographic validation of each request.

Instant activation of subscriptions and user notifications without any manual intervention.

Stable operation due to the separated architecture and correct handling of responses.

#n8n #WayForPay #APIIntegration #WorkflowAutomation #Telegram #JavaScript #PaymentGateway #Webhook #HMAC #GoogleSheets #SubscriptionAutomation #BusinessAutomation #Automation #PaymentGateway
Work details
Budget 93 USD
Added 30 September 2025
279 views
Freelancer
Mihail Glovinsky
Ukraine Kyiv  11  0

Available for hire Available for hire
11 Safes completed
On the service 7 years