问题
I want to retrieve a list of orders using the Square API. The call to retrieve orders is a POST call with a String array of order_ids however I'm not sure where I can get this information. In the docs they said I can use the ListTransactions
endpoint to get this information but I'm not able to find the order_id
within the response.
The documentation to retrieve Orders
located at: https://docs.connect.squareup.com/api/connect/v2#endpoint-batchretrieveorders
see sample response of 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
Reference: https://docs.connect.squareup.com/articles/orders-api-overview
The goal is to get a list of recent transactions/orders that list out exactly what was purchased. The Transactions
model doesn't contain Items
whereas the Orders
model does.
回答1:
The Transaction
object will include an order_id
field if you included it during the Charge
request. If you did not pass the order_id
to the Charge
request, then it will not show up.
Furthermore - just for clarity's sake, if you use Square Point of Sale, or if you haven't included the order_id
previously but still would like to view itemizations for transactions, please look at V1 ListPayments
which will include it even if there's no order_id
.
References: https://docs.connect.squareup.com/api/connect/v2#type-transaction https://docs.connect.squareup.com/api/connect/v1#get-payments
来源:https://stackoverflow.com/questions/50786827/how-to-retrieve-square-orderids-for-call-to-batchretrieveorders