I am trying to integrate WooCommerce webhooks with Django but without success. I found a solution to a similar issue, but still cant make it work.
The thing is that, Woocomerce is generating this secret key automatically. I guess that I have to hard code it by myself in the admin panel ?
Also about the code bellow(solution found in the web), Django is complaining that request has no property payload. I guess that it must be data ?
mport base64
import hashlib
import hmac
request_sig = request.headers.get("x-wc-webhook-signature")
signature = hmac.new(<your_secret_key>.encode(), request.payload, hashlib.sha256).digest()
if hmac.compare_digest(
request_sig.encode(), base64.b64encode(signature)
):
return True
return False
enter code here