How to retrieve Square orderIds for Call to BatchRetrieveORders

被刻印的时光 ゝ 提交于 2019-12-11 15:43:57

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!