Webhook calls with different application Id

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?

:waving_hand: 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

Refunds API Webhooks
Use Webhooks to Integrate with a Payroll System
Use Customer Webhooks

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.

Hi there! Just to confirm- is your application creating Payment Links via the API, and you’d like to process webhooks for both those Payment Link transactions and payments your integration handles directly, while ignoring all other activity (Square POS, other apps, etc.)?

If so, that explains the application_id discrepancy: Payment Links are processed under a Square-internal application ID, so they won’t match yours. Unfortunately, there’s no way to filter which webhook events you receive at the subscription level- you’ll receive events for all payment activity on the merchant’s account. However, I can help you figure out how to efficiently filter on your end for only the events you care about.

I’d suggest looking into storing the order_id from your CreatePaymentLink response and matching it against the order_id in incoming webhook payloads. You could also explore setting a reference_id. Here are some docs that may help:

Checkout API Overview
CreatePaymentLink reference
payment.updated webhook reference