问题
Is it possible to access any information about a merchant's customers using the Square Connect API? The most ideal piece of information would be the email address customers enter for their receipt, but but some type of unique customer id would be nice to determine repeat customers.
Looking through the Square Connect API Documents there are no endpoints for customers and Payment objects do not include any of this information. Is there another Square API with this capability?
回答1:
Not at this time. Regarding customer email addresses obtained for receipts, from the Square help center:
Based on our privacy policies and governing regulations, we cannot share cardholders' personal information with our customers when contact information is only collected for receipt purposes.
However, I'll pass this feedback along to the Connect API engineering team (I write the docs).
回答2:
This is now possible as of V2 and the transaction.tenders.customer_id
attribute.
In my use case I am attempting to get the customer from a webhook notification. As I see it, there are few steps required for this scenario:
- Issue the v1 request for the Payment using the webhook entity_id
/v1/{location_id}/payments/{payment_id}
- Issue the v2 request for the Transaction using the id returned on the Payment object. The only place the v2 transaction id is located is on the last part of the path in the
payment_url
attribute./v2/locations/{location_id}/transactions/{transactionId}
- 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}
If you have the customer_id in hand oviously you can skip straight to step 3.
来源:https://stackoverflow.com/questions/22899848/access-customer-information-using-square-connect-api