Open Whip opened 10 months ago
Signature should match
It returns error: Invalid signature passed
use \Razorpay\Api\Api; if(isset($_POST['razorpay_payment_id'])){ $rzApi = new Api(RZ_KEY, RZ_SECRET); try { $generatedSignature = $rzApi->utility->verifyPaymentSignature([ // source of error 'razorpay_order_id' => $_POST['razorpay_order_id'], 'razorpay_payment_id' => $_POST['razorpay_payment_id'], 'razorpay_signature' => RZ_SECRET // This is a constant holding my secret key ]); } catch (Exception $e) { echo $e->getMessage(); // Invalid signature passed exit; } }
v8.2
v2.9.0
For now I'm using this code which works fine
$generatedSignature = hash_hmac('sha256', $_POST['razorpay_order_id'].'|'.$_POST['razorpay_payment_id'], RZ_SECRET);
Steps to reproduce the behavior
Expected behavior
Signature should match
Actual behavior
It returns error: Invalid signature passed
Code snippets
Php version
v8.2
Library version
v2.9.0
Additional Information
For now I'm using this code which works fine