For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
Hi,
Im currently building an App that charges the user based on how many orders they get in one billing cycle.
To do that I need to know how many orders they received during the current billing cycle.
My thinking is this: Get the start and end date of the current billing cycle -> Get the orders during these dates.
But I do not know how to get the start and end date of the current billing cycle.
Is there some way to do this?
Would really appreciate your help.
Kind regards,
Noah
Solved! Go to the solution
This is an accepted solution.
I have sort of found a workaround.
What I am doing to get the start and end date of the current billing cycle is this:
- Get the currently active subscription (field needed: billing_on)
- I use the billing_on date as the end date of the current billing cycle
- I use the billing_on - 30 days as the start date of the current billing cycle (Because my billing interval is "EVERY-30-DAYS")
Hello @noah_haub !
Yes, you can use the subscription billing cycle query. You can add any of the SubscriptionBillingCycle attributes for the response(cycleStartAt and cycleEndAt).
Hope that helps!
Ah perfect thank you very much man! I didn't see that because I mostly use the REST API.
So thank you!
@ChaseKaneki is the subscription billing cycle used for customers of stores or for customers of apps?
Because to use the subscription billing cycle query, I need a subscription contract.
And to create a subscription contract, I need to include things like delivery address etc.
Also this query is under the "orders" tab.
What I need is the start and end cycle of the users of my app, not the customers of a store.
Did I understand the subscription billing cycle query wrong?
This is an accepted solution.
I have sort of found a workaround.
What I am doing to get the start and end date of the current billing cycle is this:
- Get the currently active subscription (field needed: billing_on)
- I use the billing_on date as the end date of the current billing cycle
- I use the billing_on - 30 days as the start date of the current billing cycle (Because my billing interval is "EVERY-30-DAYS")
Hi @noah_haub, I have a question whether the billing_on field will be updated if shopify successfully pays the old invoice in recurring plan?
Example my current billing_on is 2023-09-05, and 30 days pass and they are charged again, now billing_on will update to 2023-10-05?