检索与付款相关的客户

Retrieve customer related to payment

有人知道是否可以从 API 检索与交易相关的客户名称吗?

如果我在连接 v1 https://connect.squareup.com/v1/{{location_id}}/payments/{{payment_id}} 端点中跟随 "payment_url",我会在 "Paid by" 下看到它,但在其他地方找不到它

背景:我正在开发一个票务系统,该系统按 item_category 划分项目,因此厨房获得 食品,而酒吧获得 只有种饮品。

我有排队和按类别分列的门票,但我似乎无法在任何地方找到客户的名字

您需要使用 V2 Transactions API。当您调用 ListTransactionsRetrieveTransaction (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) 时,将使用可以从用于支付的卡中检索到的任何信息创建。

更新:或者,按照@Dan 的建议,将 payment_url 从 V1 RetrievePayment (RetrievePayment) 中剥离,其中包括 transaction_id 在URL 结束:https://squareup.com/dashboard/sales/transactions/TRANSACTION_ID。这样效率更高,因为您不需要循环交易,并允许您直接将其发送到 RetrieveTransaction.