Last active
July 10, 2025 16:18
-
-
Save puneetkaura/5119d2045befd4c9b8b3bc5b966487e4 to your computer and use it in GitHub Desktop.
Verify Cashfree Webhook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pg_webhook_verify(self, timestamp,request): | |
pg_payload = self.get_cashfree_headers() | |
pg_secret_key = self.api_secret_key | |
try: | |
import base64 | |
import hmac | |
import hashlib | |
import json | |
body_unicode = request.body.decode('utf-8') | |
body_data = json.dumps(body_unicode) | |
message = timestamp + body_data | |
computeSig = request.headers['X-Webhook-Signature'].encode() | |
print("computeSig: ", computeSig) | |
return True, computeSig | |
except Exception as e : | |
raise CashFreeException({"message": str(e)}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment