Skip to content

Instantly share code, notes, and snippets.

@resistorsoftware
Created November 29, 2011 19:30
Show Gist options
  • Save resistorsoftware/1406084 to your computer and use it in GitHub Desktop.
Save resistorsoftware/1406084 to your computer and use it in GitHub Desktop.
Simple WebHook parse, JSON
domain = request.env["HTTP_X_SHOPIFY_SHOP_DOMAIN"]
product_id = request.env["HTTP_X_SHOPIFY_PRODUCT_ID"]
request.body.rewind
@product = JSON.parse(request.body.read)
@shop = Shop.find_by_myshopify_domain(domain)
verified = verify_webhook(data, request.env["HTTP_X_SHOPIFY_HMAC_SHA256"])
unless verified
puts "\n\n***** Headers did not match, this call is not from Shopify!!\n"
status 200
return
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment