-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: encoding without a string argument #121
Comments
@niketnishi @RazorpayTeam - It seems like we are converting the request.body from bytes to string, and then in your code you are just converting it back to bytes. Please remove the double conversion - seems unnecessary. |
The first solution gives an error And the 2nd solution gives an error |
Hi @niketnishi sorry for the delay. We do not receive any reports of this kind of issue from our users at present. Could you please confirm us is it resolved or not ? |
Hi,
I can not confirm as currently I am not working on any project which uses
Razorpay as payment gateway.
Thank You,
Niket Nishi
…On Mon, 28 Nov 2022, 5:40 pm ankitdas13, ***@***.***> wrote:
Hi @niketnishi <https://github.com/niketnishi> sorry for the delay. We do
not receive any reports of this kind of issue from our users at present.
Could you please confirm us is it resolved or not ?
—
Reply to this email directly, view it on GitHub
<#121 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIWJESGITD7HLB2MZXWGXMDWKSOL5ANCNFSM4TYSUHLA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@niketnishi could you please close this issue? If the issue still persists you can re open this ticket. |
payload_body = request.body
webhook_signature = request.headers['X-Razorpay-Signature']
client = razorpay.Client(auth=(RAZORPAY_KEY, RAZORPAY_PASS))
client.utility.verify_webhook_signature(payload_body, webhook_signature, secret_key)
The above was working fine with python 2.7 but gives an error with python 3.6.12.
As the documentation specifies "Do not parse or cast the webhook request body.:
While generating signature at your end, ensure that the webhook body passed as an argument is the raw webhook request body. Do not parse or cast the webhook request body."
And this gives a TypeError: encoding without a string argument. And when I typecast payload_body to string using str() this throws an exception saying that razorpay.errors.SignatureVerificationError: Razorpay Signature Verification Failed which means the generated sha256 does not match the webhook signature I receive from your end.
Please help to resolve the issue.
The text was updated successfully, but these errors were encountered: