Hello, I’m currently experiencing an issue with webhooks. Square seems to have difficulty reaching my ngrok URLs when I’m in production, I always receive 504 error, but everything works fine in sandbox. Can you advise on how to resolve this?
I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:
Additional Documentation
Square Sandbox
Get Started
https://developer.squareup.com/docs/oauth-api/walkthrough2
If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.
The issue you’re experiencing might be due to the difference between the Sandbox and Production environments. The Sandbox environment is designed for testing and might not have the same restrictions or requirements as the Production environment.
One common issue is the use of HTTPS. Square’s production environment requires HTTPS for all communication, including webhooks. If your ngrok setup doesn’t support HTTPS, this could be the cause of your problem. Make sure your ngrok tunnel supports HTTPS and that your server is correctly configured to handle HTTPS requests.
Also, ensure that your server is correctly processing the incoming webhook notifications and responding with an HTTP 2xx status code within 10 seconds of receiving the notification. If Square doesn’t receive a valid response within this timeframe, it considers the delivery attempt to have failed.
Lastly, check your server logs and the webhook event logs in the Developer Dashboard. These logs can provide more information about any errors or issues that might be occurring.
This answer was reviewed by @Bryan-Square.
Thank you for your response. The strange part is that before this problem occurred, prior to the holiday break last Christmas, I can test it and was able to receive production’s webhook without any issues. Additionally, I’m certain that my Ngrok setup supports HTTPS. I’ve also checked the event logs and found a 504 error.