#phal0r
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
you can use backdate_start_date when you create a new subscription to specify the 1st of that month https://stripe.com/docs/api/subscriptions/create#create_subscription-backdate_start_date
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If I specify "backdate_start_date" will this also set the billing cycle anchor to the first of the next month automatically?
And in general: The guide for using SubscriptionSchedules should achieve the same or am I on the wrong track?
I'm looking into this, please give me a moment will get back to you shortly
I think the easiest way to achieve what you're looking for is doing what I suggested
- Create a subscription with a
back_start_date : (first of the month)and addproration_behavior: none
- subscription can be created to start in the future and start at the first day of the selected month
what do you really mean by that?
In our app, the user may choose when to start the subscription (it is a monthly ticket for public transport). If the ticket is for the current month, the subscription must be backdated to the first of the month.
If the user chooses a future month, i.e. from current point of view this would be march or april, the subscription must start 12am on the first of the month.
The reason is, that we want to listen to the invoice.paid webhook event and create the monthly ticket in this case.
So, if the user selects the current month, you suggest to create a subscription with the back_start_date parameter and if the subscription should start in a future month, we must use SubscriptionSchedules. Is this correct?
yes correct
I will try with the back_start_date and will come back to this thread
if you don't really care about the start_date of the current month you can use a combination of start_date: now and billing_cycle_anchor: 1st of next month and proration_behavior: none
I will check this aswell
It works for the current month, but the next period (generated invoice) is from 1st March until 29th of March, but March has 31 days.
I thought Stripe will take care automatically of that, no?
Hi there ๐ jumping in as my teammate needed to step away, can you share more context or an ID of a related object?
of course, generated subscription is sub_1McVCSBedPgr0Zv2aDounDc9 and the invoice in questions is the upcoming invoice (can't find the id in the dashboard), but the link is https://dashboard.stripe.com/test/customers/cus_NKYMwVOZ6xJ95z/upcoming_invoice/sub_1McVCSBedPgr0Zv2aDounDc9
invoice number is B8442AA8-0047
Thank you, pulling that up
It looks like that is because the billing cycle anchor was pinned to Feb 28th (UTC) in the Subscription's creation request, so it is expected for the billing cycle anchor to remain on the 28th (UTC) of each month. What were you hoping to accomplish instead?
Setting a billing cycle anchor to the concept of "the last day of the month" is tricky to do since we pin to the date of the month instead, and not all months have the same length. Once pinned to the 31st of a month, we will automatically adjust the anchor to correspond with the day in the month closest to that (28-30 depending).