#arvindkgs-backdate-subscription
1 messages · Page 1 of 1 (latest)
FYI request-id req_j71ijYaC3MsrO0
I'm not seeing an end-date on this request
could you maybe try it again?
Sure
end_date is optional right?
curl https://api.stripe.com/v1/subscription_schedules \
-d customer=cus_JsNaCHWWnNDFmd \
-d start_date=1611993600 \
-d end_behavior=release \
-d "phases[0][items][0][price]"=price_1J7wR4BuQq6cUmE7xtohGWA6 \
-d "phases[0][items][0][quantity]"=1 \
-d "phases[0][end_date]"=1613808000
same error
request id req_OOvImlWj6SArWm
gotcha
taking a look
Looking in to this, I am not sure why a call without and end date would error like that. For the second call, 1613808000 is actually a year in the past. Can you try that one more time with an end date from this year like 1645374606?
Same error
curl https://api.stripe.com/v1/subscription_schedules \
-d customer=cus_JsNaCHWWnNDFmd \
-d start_date=1641024000 \
-d end_behavior=release \
-d "phases[0][items][0][price]"=price_1J7wR4BuQq6cUmE7xtohGWA6 \
-d "phases[0][items][0][quantity]"=1 \
-d "phases[0][end_date]"=1613808000
Sorry different error
``start_datemust be less than each phase'send_dateor its derived end date based oniterationsandplans.
request-id: req_OjatgkEnYzQ5DR
That looks like the same end date as before. Can you try curl https://api.stripe.com/v1/subscription_schedules \ -d customer=cus_JsNaCHWWnNDFmd \ -d start_date=1611993600 \ -d end_behavior=release \ -d "phases[0][items][0][price]"=price_1J7wR4BuQq6cUmE7xtohGWA6 \ -d "phases[0][items][0][quantity]"=1 \ -d "phases[0][end_date]"=1645374606
This works. Does that mean the start-date cannot be a month before from today?
I changed start_date to a year back while leaving the end_Date unchanged and it works
should the end_date always be the current time?
What if the start_date is in the future? The same end_date fails
What should I set the value for that?
@agile meadow can you please respond?
I was trying to figure that out myself. That might be the issue, that you were trying to backdate a year for a monthly subscription. I think that the start date may have to be less than one subscription cycle in the past
So just to take a step back here, what is your end goal? To create a subscription backdated a year and to retroactively charge for a year of the monthly price?
@agile meadow Goal is billing date can be any day (past, present, future). If in past it should prorate and create corresponding invoice.
Hello. Taking over for Pompey here
@polar heath Hello
Can you try something here. Can you try just try creating a subscription with backdate_start_date and billing_cycle_anchor? https://stripe.com/docs/api/subscriptions/create#create_subscription-backdate_start_date
Will your schedule only have 1 phase?
Yes
If so, a subscription is probably a better route
Let me try this
@polar heath This works. But lets take a step back
I would want the invoice to always start at the first of next month. Meaning it should not generate an initial invoice from current date to 1st of next month. Rather invoice should only be generated from 1st of next month, which should prorate the previous missing days
@polar heath is this possible?
You can use billing_cycle_anchor to achieve that
backdate_start_date will be the backdated date. Then you would set billing_cycle_anchor to the 1st of the month
I tried it. I set toda
I set todays date at 00:00:00 AM as the backdated date and billing_cycle_anchor to 1st of March. It generates invoice from 18th Feb to 1st March. It says upcoming invoice is from 1st March to 1st April
I don't want the current invoice from 18th Feb to 1st March
@polar heath Also I noticed that subscription always start from current moment, and if I set the backdated date to say current date 00:00:00, it will add proration for the time from midnight till current time and this appears in the invoice. Is my assumption correct?
@digital helm what you want is not possible today unfortunately
if you backdate, it's to charge right now. You can't say "I want to charge for the past 12 months but really only charge in 2 weeks" that's not something we support
you'll have to do the math yourself in that case and add it to their next invoice for example
@oblique blaze And what timezone does Stripe accept the time in? For example, if I wanted billing to start from midnight today, should the time be - 1645171200 which translates to Friday February 18, 2022 00:00:00 (am) in time zone America/Los Angeles (PST)
Or 1645142400 which translates to Friday February 18, 2022 00:00:00 (am) in time zone UTC (UTC)
@oblique blaze All I want is billing to start from midnight of today meaning 00:00:00 AM of today
So it should be 1645142400 if I want billing to start from today 00:00:00 AM
@oblique blaze is that right?
according to https://www.unixtimestamp.com/ yes
Okay thank you so much
@oblique blaze Can I use trials to achieve this?
yeah, what I'd do is calculate the proration/amount owed myself, and then I'd start a subscription with a trial period until next month's 1st day, and right after I'd add a pending invoice item for the proration amount they owe me to add to the next invoice (for next month)
Got it. Thank you