App reviews, troubleshooting, and recommendations
I am trying to verify a Shopify webhook request for the topic orders/create, but the verification is returning False, I am not able to figure out the reason. Here's the code snippet I am using to verify the request.
class ShopifyWebhookOrderCreate(APIView): def post(self, request): verified = verify_webhook(request.body, request.META.get('HTTP_X_SHOPIFY_HMAC_SHA256')) if not verified: return Response(status=status.HTTP_401_UNAUTHORIZED) ... ... ...
and for verifying the request I am doing this:-
def verify_webhook(data, hmac_header): CLIENT_SECRET = config('SHOPIFY_CLIENT_SECRET') digest = hmac.new(CLIENT_SECRET.encode('utf-8'), data, digestmod=hashlib.sha256).digest() computed_hmac = base64.b64encode(digest) return hmac.compare_digest(computed_hmac, hmac_header.encode('utf-8'))
request.body format is b'{'the': 'data'}'
I verified the SECRET with the Shopify app.
Were you able to solve this? I'm having the same problem
my verify class is returning False. Not sure why.
Transform this holiday season into a shopping spree. Plus, learn how to effortlessly open ...
By Jasonh Dec 8, 2023Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023