I’m having an issue using the Square Orders API with the Online Checkout links. We have a flow where a customer will pay using the link, and will then be directed to our website via the “Send buyers to your site after purchase” option to fill out an additional form. This sends the customer to our site with a
transactionId query parameter which I can then use with the Orders API (as in
GET https://connect.squareup.com/v2/orders/[transactionId]) to get the transaction on our custom backend. I would like to use this to link the customer information (phone number, email, etc) to the information the user fills out on our custom form. The Orders API documentation says that there should be a
customer_id field in the response body, but sometimes it’s not there.
Does anyone know why that is? And if it’s not there, where can I go to get the associated customer? I can see the customer in the Square Dashboard, so I know the relation exists.
I also found this topic where it was suggested to use the deprecated
RetrieveTransaction API, but this didn’t work either. I copied the location ID from the response body of the order to create an API endpoint like
https://connect.squareup.com/v2/locations/[location]/transactions/[original-transaction-id] but this gave me a 404.
Currently with the Checkout API the customer information that is collected during checkout won’t create a
customer_id that is seen in the order. The Checkout API will create a new customer profile that will only be retrievable with the Transactions API by calling RetrieveTransaction with the returned Id. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team.
Ok, no worries, but at the moment the old transactions API doesn’t seem to work either. Like I mentioned, I used the location ID returned by the new Orders API and passed that into the deprecated endpoint along with the transaction ID returned by the checkout link. Am I doing something wrong?
Just to be clear this is a checkout link create with the Checkout API, right?
This was created using the “Online Checkout” UI here. I’m not sure if that’s the same function.
Okay, that is a different Checkout. Unfortunately the
customer_id isn’t guaranteed to be in the order with links created by the Online Checkout.
Ok, that’s too bad. Thanks for the help!
Sorry for bringing up such an old subject, I just came across this. In brief, I have repeatedly failed to retrieve customer data when online transactions take place. Neither orders or payments give me a valid customer_id to retrieve the associated customer record; so transactions it is.
However, when watch_new_event returns an event, I see no way to map the “event” to the “event type = transaction”. So I can not get customer data.
If you say that there is still no guarantee that a valid customer_id is in all online transactions, then we will be forced to manually transfer customer data for all online transactions and I can stop looking.
Thanks for your time,
I hope that is clear enough,
This is such an old post and we’ve made improvements but the payment will almost alway have a
customer_id and should be used as the source of truth for finding the customer information.