From f117540fa1cf481eb0505dd2fde485f65da259ce Mon Sep 17 00:00:00 2001 From: Ram Prakash Singh <45222925+ramth05@users.noreply.github.com> Date: Thu, 3 Jun 2021 22:13:42 +0530 Subject: [PATCH] fixed webhook signature mismatch in case json_encode/decode issue (#251) --- Controller/Payment/Webhook.php | 4 +++- composer.json | 2 +- etc/module.xml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Controller/Payment/Webhook.php b/Controller/Payment/Webhook.php index cb59a25a..b0884712 100644 --- a/Controller/Payment/Webhook.php +++ b/Controller/Payment/Webhook.php @@ -135,7 +135,9 @@ public function execute() try { - $this->rzp->utility->verifyWebhookSignature(json_encode($post), $_SERVER['HTTP_X_RAZORPAY_SIGNATURE'], $webhookSecret); + $postData = file_get_contents('php://input'); + + $this->rzp->utility->verifyWebhookSignature($postData, $_SERVER['HTTP_X_RAZORPAY_SIGNATURE'], $webhookSecret); } catch (Errors\SignatureVerificationError $e) { diff --git a/composer.json b/composer.json index 8eedf3f6..34860e4f 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "razorpay/magento", "description": "Razorpay Magento 2.0 plugin for accepting payments.", - "version": "3.5.2", + "version": "3.5.3", "require": { "php": "~5.5.0|~5.6.0|^7.0", "razorpay/razorpay": "2.*" diff --git a/etc/module.xml b/etc/module.xml index ec2d6feb..afdd6a61 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - +