I’m having a bit of trouble with getting the details of the buyers first name and surname into a custom confirmation email. The only way I can see is to get the buyers email address from the payment.created webhook and use this to run a search against the customer end point ‘POST /v2/customers/search’ then include a query filter for the customer email address in the body of the call.
This worked well a couple of times in testing but since taking some actual payments, it doesn’t look like the customer is being created with their first name and surname personal details stored in the customer directory. The customer record is there but with just the email address. I have ‘Instant Profiles’ turned on in the customer directory settings so I’m not sure why it isn’t saving all the buyer’s details. Is there a failsafe method of retrieving the buyers first name and surname once a payment has gone through?
Hi @rickh welcome to the forums!
How are you creating the customers in the first place? If you’re using the API (ie
CreateCustomer), you would be passing in the customer’s data there, which would be saved in the directory. It sounds like however you’re creating the customer, you’re only passing the email to Square instead of additional details.
If you’re relying on in-person payments to create customers with full details automatically, this definitely is not guaranteed. It totally depends on what we can pull off the card directly (and some cases like paying through mobile or contactless card, I don’t think we are able to retrieve any information other than the card information).
Hi @sjosey - thanks for your reply. We’re actually using the Square online website (built using Weebly I believe) to take the payment online. The checkout form therefore is part of the default setup and I can’t see how I can use the API through that to create the customer separately. The secure checkout form does include fields for First Name and Last Name though so I’m presuming that gets passed somewhere?
Gotcha, thanks for clarifying. I’m not 100% sure how Square Online handles that, but presumably you’re right it should be passed along. Can you provide your merchant id and the
customer_ids that only have emails? I can take a look to see how they were created.
Our merchant ID is
A couple of customer IDs that only have emails are