Solution for Make.com users facing WayForPay RAW data issue
If you’re working with WayForPay → Make.com integration and your webhook receives unparsed RAW data, this post will help you.
WayForPay sends transaction notifications as a RAW encrypted string, which cannot be parsed using Make’s JSON tools (like Parse JSON).
Below is a working external PHP solution to handle this problem safely and efficiently.
Solution: Parsing RAW WayForPay data outside Make.com
Problem
The payment system WayForPay sends transaction data in an encrypted RAW format, which cannot be directly parsed in Make.com (there is no built-in decryption/decoder module).
Solution
Create a small PHP script on your own server to:
- Receive RAW data from WayForPay
- Decode and parse it into JSON
- Forward the clean, structured JSON to your Make webhook
Universal PHP Script
Save this code as wayforpay-handler.php on your hosting:
<?php
// === ERROR & LOG SETTINGS ===
ini_set('display_errors', 0);
ini_set('log_errors', 1);
ini_set('error_log', __DIR__ . '/wayforpay_php_errors.log');
header('Content-Type: application/json; charset=UTF-8');
// 🔑 YOUR WAYFORPAY SECRET KEY
$merchantSecret = 'YOUR_SECRET_KEY_HERE';
// === READ RAW DATA ===
$raw = file_get_contents('php://input');
file_put_contents(__DIR__ . '/wayforpay_log.txt', date('c') . " RAW: $raw\n", FILE_APPEND);
$data = json_decode($raw, true);
if (json_last_error() !== JSON_ERROR_NONE) {
file_put_contents(__DIR__ . '/wayforpay_log.txt', date('c') . " JSON ERROR\n", FILE_APPEND);
http_response_code(400);
echo json_encode(['status' => 'error']);
exit;
}
// === EXTRACT CLIENT NAME ===
$clientName = $data['clientName'] ?? null;
if ($clientName === 'NoCLIENT NAME' || empty($clientName)) {
$clientName = null;
}
if (!$clientName && !empty($data['clientFields'])) {
foreach ($data['clientFields'] as $field) {
if (!empty($field['name']) && !empty($field['value'])) {
$fieldName = mb_strtolower($field['name'], 'UTF-8');
if (strpos($fieldName, 'ім') !== false || strpos($fieldName, 'им') !== false || strpos($fieldName, 'name') !== false) {
$clientName = $field['value'];
break;
}
}
}
}
if (!$clientName) {
$firstName = $data['clientFirstName'] ?? '';
$lastName = $data['clientLastName'] ?? '';
$clientName = trim("$firstName $lastName");
}
$clientName = $clientName ?: 'Client';
$data['clientName'] = $clientName;
// === ROUTE BY PRODUCT ===
$webhooks = [
'product_1' => 'https://hook.eu2.make.com/YOUR_WEBHOOK_ID_1',
'product_2' => 'https://hook.eu2.make.com/YOUR_WEBHOOK_ID_2',
];
$productName = trim($data['products'][0]['name'] ?? '');
$productLower = mb_strtolower($productName, 'UTF-8');
$hook_url = '';
$productMapping = [
'product_1_name_lowercase' => $webhooks['product_1'],
'product_2_name_lowercase' => $webhooks['product_2'],
];
foreach ($productMapping as $pattern => $url) {
if (strpos($productLower, $pattern) !== false) {
$hook_url = $url;
break;
}
}
if (!$hook_url) {
file_put_contents(__DIR__ . '/wayforpay_log.txt', date('c') . " ⚠️ UNKNOWN PRODUCT: '$productName'\n", FILE_APPEND);
}
// === SEND RESPONSE TO WAYFORPAY ===
$orderReference = $data['orderReference'] ?? '';
$status = 'accept';
$time = time();
$signString = implode(';', [$orderReference, $status, $time]);
$signature = hash_hmac('md5', $signString, $merchantSecret);
$wayforpayResponse = [
'orderReference' => $orderReference,
'status' => $status,
'time' => $time,
'signature' => $signature
];
http_response_code(200);
echo json_encode($wayforpayResponse);
flush();
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
}
// === SEND TO MAKE.COM ===
if ($hook_url) {
$ch = curl_init($hook_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json; charset=UTF-8']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
file_put_contents(__DIR__ . '/wayforpay_log.txt', date('c') . " SENT TO MAKE: $hook_url | PRODUCT: $productName | CLIENT: $clientName | HTTP $httpCode\n", FILE_APPEND);
}
?>
Setup Steps
- On your server
- Upload the PHP script to your hosting
- Replace
YOUR_SECRET_KEY_HERE with your WayForPay secret key
- Add your Make webhook URLs
- Set up product routing in
$productMapping
- In WayForPay Merchant Account
- Go to merchant settings
- Set
serviceUrl to your script URL (e.g., https://yourdomain.com/wayforpay-handler.php)
- In Make.com
- Create a Webhook module to receive incoming data
- You’ll now get clean, structured JSON ready for further automation
Benefits
Correct WayForPay acknowledgment → no duplicate notifications
Parsed and ready-to-use JSON in Make
Full Unicode support (Ukrainian, Cyrillic, etc.)
Auto client name detection
Multi-product routing
Detailed logging for debugging
Logging
Example from wayforpay_log.txt:
2025-10-14T01:10:57+03:00 RAW: {...}
2025-10-14T01:10:57+03:00 SENT TO MAKE: https://hook... | PRODUCT: ... | CLIENT: ... | HTTP 200
Questions?
If you face any issues, check wayforpay_log.txt or wayforpay_php_errors.log for details.