如何检索 Square orderIds 以调用 BatchRetrieveORders

How to retrieve Square orderIds for Call to BatchRetrieveORders

我想使用 Square API 检索订单列表。检索订单的调用是一个 POST 调用,带有 order_ids 的字符串数组,但我不确定从哪里可以获得此信息。在文档中,他们说我可以使用 ListTransactions 端点来获取此信息,但我无法在响应中找到 order_id

要检索的文档 Orders 位于:https://docs.connect.squareup.com/api/connect/v2#endpoint-batchretrieveorders

查看 ListTransactions 的示例响应:https://docs.connect.squareup.com/api/connect/v2#endpoint-listtransactions

The Orders API does not support listing of orders. To access order details, you will need to fetch the order's ID by querying transactions using the ListTransactions and RetrieveTransaction endpoints, and then fetching the order using the BatchRetrieveOrders endpoint

参考:https://docs.connect.squareup.com/articles/orders-api-overview

目标是获取最近 transactions/orders 的列表,其中准确列出了购买的商品。 Transactions 模型不包含 ItemsOrders 模型包含。

如果您在 Charge 请求期间包含 Transaction 对象,则该对象将包含一个 order_id 字段。如果您没有将 order_id 传递给 Charge 请求,那么它将不会显示。

此外 - 为清楚起见,如果您使用 Square Point of Sale,或者如果您之前没有包含 order_id 但仍想查看交易明细,请查看 V1 ListPayments 即使没有 order_id.

也会包含它

参考资料: https://docs.connect.squareup.com/api/connect/v2#type-transaction https://docs.connect.squareup.com/api/connect/v1#get-payments