Query subscriptions contracts by nextBillingDate

Phillip_Malboeu
Shopify Partner
2 0 1

Hello Subscriptions team,

So subscriptions apps are responsible for initiating billing attempts on the the subscriptions' next billing date.
However, there's no clear way to query SubscriptionContracts by nextBillingDate. So if the app is supposed is create billing attempts today Feb. the 22nd, what's the best way to fetch all contracts that are supposed to trigger on that day?

Thank you for your time,

Phil

0 Likes
ewalker
Shopify Staff
Shopify Staff
8 0 4

The expectation for apps is that they maintain an up-to-date `nextBillingDate` to subscription contract mapping their own database. This can be done through the listening to subscription contract webhooks.

This could be a feature we consider introducing in the future. As a warning, at large scale, querying Shopify for contracts in this manner would consume Graphql API points and limit how quickly orders could be placed.

0 Likes
Phillip_Malboeu
Shopify Partner
2 0 1

Thanks for your quick answer @ewalker!

I just find it strange that we're expected to build a database that is a replica of existing data in your databases.

Thanks,
Phil