Access Order Subscription Details via Shopify REST API

Access Order Subscription Details via Shopify REST API

user072319
Shopify Partner
131 0 17

Hello friends,

 

I have a Shopify live app.

 

I'm importing the client store orders. For one client they sells products including subscription beauty products. The subscription is handled through https://app.smartrr.comI need to retrieve the subscription details for these orders using the Shopify REST API.

 

Could someone please guide me on how to access subscription information for orders through the REST API? 

 

Are there specific endpoints or fields I should be aware of for fetching these details? If it is not available in REST API how to get it through GraphQL or other methods?

 

Thank you in advance for your help!

Reply 1 (1)

Liam
Community Manager
3106 339 870

To get subscription information for orders in Shopify, you can use the subscriptionContracts query to list subscription contracts and their associated orders. Here's a basic example of how you can construct such a query:

query GetSubscriptionContracts {
  subscriptionContracts(first: 10) {
    edges {
      node {
        id
        status
        nextBillingDate
        orders(first: 5) {
          edges {
            node {
              id
              createdAt
              totalPriceSet {
                shopMoney {
                  amount
                  currencyCode
                }
              }
            }
          }
        }
      }
    }
  }
}

 

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog