Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to get renewed subscription orders from Order api

How to get renewed subscription orders from Order api

mohsinmalik568
Visitor
3 0 0

I am working with shopify rails i want to calculate the renewal rate of the subscription contracts but i am unable to find any source where i can know that the order is renewed and belong to specific subscription contract using Order Api can anyone help?

Replies 2 (2)

ya_shopify
Shopify Staff
14 4 5

Hello mohsinmalik568,

Thank you for you question!

The SubscriptionContract GraphQL type might be able to help you.

Through the SubscriptionContract type you can access:

  • originOrder: The order from which this contract originated.
  • orders: A list of orders that are associated with the SubscriptionContract. An order is created each time a SubscriptionContract is successfully billed using the subscriptionBillingAttemptCreate mutation
  • billingAttempts: A list of billing attempts that are associated with the SubscriptionContract

You can find out more about the SubscriptionContract API page here: https://shopify.dev/docs/admin-api/graphql/reference/orders/subscriptioncontract

 

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

LKBM
Shopify Partner
1 0 0

To add to this, you can also find the subscriptionContract via the orderID in GraphQL:

 

{
    order(id: "gid://shopify/Order/XXXX") {
        lineItems(first:10) {
            edges {
                node {
                    contract { id }
                }
            }
        }
    }
}