We have integrated Square webhooks into our system to update transaction payment statuses in cases where updates are missed after payment completion.
However, we have observed that when a merchant connects their Square account with our system, webhook events are triggered for all transactions occurring on that merchant account — including transactions unrelated to our ticketing system (product: SQUARE_POS).
These frequent and unnecessary webhook calls are creating additional load on our database and increasing CPU usage, since our system attempts to validate incoming webhook transactions against all transactions stored in our platform.
We have been trying to identify a reliable field in the webhook payload that can help us distinguish transactions initiated through our system from other merchant transactions.
So far, we identified the following fields:
application_id
square_product (ECOMMERCE_API)
Using these fields, we can partially determine whether a transaction may belong to our system.
However, we noticed that transactions created using Square Payment Links are returning a different application_id:
Payment Link transaction application_id: sq******w46nJ_**************A
Our application application_id: sq****-Ibt****************tQ
If the application_id matched our application’s ID, we could have reliably filtered webhook events and processed only transactions originating from our system.
Could someone please help clarify:
Why does the application_id differ for Payment Link transactions?
Is there any other field or recommended approach to accurately identify webhook events related only to transactions initiated through our system, especially for Payment Link payments?