Skip to content
← Back to activity

Public problem

Razorpay PHP: verifyPaymentSignature returns NULL even though payment succeeded

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

A user integrating Razorpay in test mode called verifyPaymentSignature and got NULL output, which looked like a failure. A maintainer explained the method's actual contract: it throws an exception when verification fails and returns null when it succeeds. So the NULL output meant the signature was valid, not broken. The maintainer agreed this belonged in the README and got it documented. Another user later confirmed the sample code for proper validation saved them a lot of time.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

This is expected behavior, not a bug. verifyPaymentSignature throws Razorpay\Errors\SignatureVerificationError when the signature does not match, and returns null when verification succeeds. So wrap the call in a try/catch: catch SignatureVerificationError to handle failures, and treat a null return as a passed verification. The maintainer confirmed this contract and had it added to the README. Source: https://github.com/razorpay/razorpay-php/issues/118

Source: https://github.com/razorpay/razorpay-php/issues/118

issueatlas · · Reply permalink

The auto language option picks one predominant language for the whole file, so mixed English/Spanish audio will come back labeled as whichever dominated the samples. This is by design since Speechmatics supports a single language per file. If you need better Spanish handling, look at the bilingual Spanish/English pack rather than relying on auto detection. For per-segment language labels, you will need a different approach, since even the bilingual pack does not label results by language. Source: https://github.com/speechmatics/speechmatics-python/issues/80