Search code examples
square-connect

Square Connect API customer_id not populated when Listing Transactions


I am using v2 of the connect api to list transactions for a specific date range. All of the transactions that I get back never have the customer_id populated in any of the Tender objects even though I know some customers are known by square. I am able to successfully retrieve all of the other data. The resource I am using is locations/{location_id}/transactions and specifying the begin_time and end_time in the query string . What am I missing?

Edit

I downloaded my transactions using the export function and none of the transactions have a customer name or Id. What is required to have this information populated? Maybe that is where I am going wrong. Does this have to be a customer I add myself or does it include customers added by Square? Is it required the customer to have their receipt sent to them by email?


Solution

  • I recently figured out how to retrieve customer information, I recorded it here: Access customer information using Square Connect API

    Assuming that you've actually recorded a customer on the sale, the customer_id should be present on each of your tenders...

    Issue the v2 request for the Customer identified on the Payment tender(s). If there are multiple tenders the customerId should be the same for each. /v2/customers/{transaction.tenders[0].customer_id}

    Note: I also reported a similar issue: customer_id is not populated on transaction tender and for a few days Square acknowleged in the comments that there were going to fix it. Then they seemingly deleted the comment from SO. As of testing I was doing last night, all transactions had the customer_id populated in real time.

    Good Luck!