Dan
Dan

Reputation: 108

Retrieve customer related to payment

Anyone know if it's possible to retrieve the customer name related to a transaction from the API?

I see it under "Paid by" if I follow the "payment_url" in the connect v1 https://connect.squareup.com/v1/{{location_id}}/payments/{{payment_id}} endpoint but can't see to find it anywhere else

Background: I'm working on a ticketing system that breaks out items by item_category so a kitchen gets only food items and the bar gets only drink items.

I have queues and itemized tickets by category BUT I can't seem to find the customer's name anywhere

Upvotes: 0

Views: 198

Answers (1)

sjosey
sjosey

Reputation: 1348

You'll need to utilize the V2 Transactions API. When you call ListTransactions or RetrieveTransaction (ListTransactions), the Transaction object will have an array of Tenders, tenders, which has a field called customer_id. With this id, you will be able to pass it to RetrieveCustomer (RetrieveCustomer) to find out their name. Note that if you're not explicitly filling out their name, the name might not be available (an "instant profile" (Instant Profiles) will be created with whatever information can be retrieve from the card used to pay).

Update: Alternatively, as suggested by @Dan, would be to strip the payment_url from a V1 RetrievePayment (RetrievePayment) which includes the transaction_id at the end of the URL: https://squareup.com/dashboard/sales/transactions/TRANSACTION_ID. This is more efficient as you won't need to loop through transactions, and allow you to send it straight to RetrieveTransaction.

Upvotes: 1

Related Questions