For example, if I created a static payment through Square website https://square.link/u/XxXxXxXxXxXxXx, can I add extra parameter like this https://square.link/u/XxXxXxXxXxXxXx?session_id=ABC so that when I receive webhook POST the input data would have session_id=ABC in there?
Stripe supports this, which I think is very convenient for people who find it inconvenient to generate dynamic payment links for each checkout session. As I’m new to Square, I want to ask if there is a similar feature. Thanks!
You can add this to a redirect_url when you create a link with the Checkout API. 
Not sure how that works, but the point is I want to avoid creating a new payment link each time using the API. If I specify redirect_url at the link creation time, I can’t change it without creating a new link, right?
Each link you create with the API is a one time use link. You’ll have to crate a new link for every customer. Unless you use the checkout link created in the Seller Dashboard. If you use that link there there’s no way to pass extra parameters. 
Good to know, thanks! I will try to propose this as a feature request, as I think it is important.
1 Like
The Checkout link is deprecated.
I found a way to accomplish this using the redirect url. It requires a little programming.
You need to call the create payment link API to dynamically build your payment link and you add the userid or customerid to the end of the redirect url. You will then have your info you need to adjust payment info inside your database.
The API returns an url that you will use for your payment link that will use to check out just like you created it using the square website.
It won’t work for webhooks but redirect.urls will work.
for anyone still trying to do this I got around passing in these parameters by creating an endpoint/server that takes in query parameters and verifies them then uses a create payment link api call to create payment link using the query parameters as metadata/reference Id then redirects to said payment link created. Its slow but fixes issue and you can add caching in case someone tries to redirect to same url. But this is a pretty painful way to get around what could easily be fixed by just adding in basic features to match payments with other resource Ids.