Discussing APIs and development related to customers, discounts, and order management.
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.com. I 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!
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