Hey folks, I'm encountering a critical issue where my Django backend is unable to receive confirmation from Square about whether a payment has been completed.
Here are the environment details for reference:- Python: 3.13.2
- Django: 5.1.6
- Square SDK: 43.0.0.20250618
Problem Summary:The core flow of the payment process is as follows:- The user creates an order via the CreateSquareOrder method.
- This successfully generates a Square-hosted checkout page where the user completes the payment.
- The payment is processed correctly—I can confirm the funds are reaching my Square account.
However, the issue arises after payment is completed:- The webhook I’ve configured (https://api.betakplus.com/api/wallet/webhooks/square/)
is supposed to be triggered automatically by Square to confirm the payment.
- Unfortunately, this webhook is not being triggered properly. I’ve checked the server logs, and I consistently receive a 401 Unauthorized response from Square's webhook call attempts.
- Because the webhook is failing, the subsequent logic in my Django app—specifically, the VerifySquareOrder method—is not executed, meaning critical application records are never created.
Additional Information:Below is the backend code I’m currently using to handle CreateSquareOrder, SquareWebhookView and VerifySquareOrder requests. I’ve followed the latest version guidelines and best practices as per the Square documentation:
Click here to see full code that i am using in backend