How can i get Payment details in Orders API

Chirag_Banjan
Tourist
3 0 2

How can I retrieve transactions details like(payment gateway, payment gateway transaction id etc) in the Orders API?

Replies 4 (4)

Zameer
Shopify Staff
297 31 90

Hey there,

 

You would actually need to use the Transactions API in order to retrieve this data.

 

For example, `GET /admin/orders/#{order_id}/transactions.json` would return all transactions associated with the provided order id.

To learn more visit the Shopify Help Center or the Community Blog.

chiragb
Visitor
1 0 0

Thank you for your reply.

My requirements is to retrieve orders(along with transaction details) for a given date range.
Consider for any specified date range I have around 500 orders,
So I make 2 calls(limit 250) to Orders API to retrieve order details, then for every 500 orders, I need to make 1 call to Transactions API?
So in all 502 calls? Right?
One Issue I am facing is I cannot make lots of Async call to Shopify as it hits the Rate limiting(4/2 calls per second) very soon. 

Is there any other approach I can use to retrieve such data? Waiting for rate limit to reset will be too slow for us.
Also is there any way where one can request to increase rate limiting for the App? 

Josh
Shopify Staff
1134 84 233

Hey there, 

 

Your assumption was correct, you'd have to get the orders via the Order API first, and then to get their transactions it would require an additional API call per order.

 

If you're hitting the rate limit though, the fix there would be to make your calls more slowly and monitor the HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT response header to make sure that you're staying within the call limit as opposed to requesting additional calls.

 

Another potential approach here would be to experiment with abandoning REST API calls altogether and giving GraphQL a try. It'll allow you to grab information on multiple resources at the same time all in a single call. So you would be able to fetch orders and their transactions at the same time. 

 

You can even use GraphQL and REST at the same time since they both have their own separate call limits, and that'll allow your app to have some extra bandwidth while still staying within limitations. 

Josh | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Chirag_Banjan
Tourist
3 0 2

Thank you for your reply.
However, I see payment gateway Transaction ID is missing for most of the orders, mainly Stripe. I can see the transaction ID for PayPal. Does Shopify provide Payment information for the order that was processed via Stripe?

{
  orders(first:250,reverse:true) {
    edges {
      node {
        id
        transactions{
          gateway
          authorizationCode
        }
      }
    }
  }
}