Customer_id is not always available in Orders API


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[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[location]/transactions/[original-transaction-id] but this gave me a 404.

:wave: 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. :slightly_smiling_face:

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!