#spera_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1338468447625019425
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
๐
Yeah you should remove the subscription_cancel_at_period_end parameter
then we don't retrieve hypothetical invoices for canceled subscriptions which we would need to show our customers what price they would pay if they resumed their subscriptions (without having to calculate it ourselves)
That property has no impact on the invoice generated
It wont generate a proration or any change, it just mentions that the Subscription should be canceled at the end
But in all cases, that's not supported for Subscriprion attached to a SubscriptionScheduler.
no, we currently use that flag to review upcoming invoices for cancel_at_period_end subscriptions which works perfectly fine.
It just doesn't work if the subscription scheduler is involved which doesn't make sense as we are just reviewing an upcoming invoice and not making any updates to the subscription at all
Can you try the Preview Invoice endpoint instead? https://docs.stripe.com/api/invoices/create_preview
how would this endpoint factor in the cancel_at_period_end = false behavior?
Because it's a newer endpoint designed as replacement for the Upcoming Invoice endpoint. Perhaps this issue isn't prevalent there? I don't know
But the general recommendation is to use Invoice previews for this kind of thing
unfortunately I get "No upcoming invoices for customer" with only the subscription as parameter.
are there any parameters that simulate the cancel at period end = false parameter as in the upcoming invoice endpoint?
FWIW, your original request might work is you pass schedule instead of subscription: https://docs.stripe.com/api/invoices/upcoming#upcoming_invoice-schedule
I just found this parameter in the docs:
subscription_details.cancel_at_period_en
gonna try it
You'd need to replace subscription_cancel_at_period_end with https://docs.stripe.com/api/invoices/upcoming#upcoming_invoice-schedule_details
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Won't work:
Cannot be used with schedule or schedule_details fields.
You need to use schedule and schedule_details when the sub is controlled by a schedule
what parameter in schedule_details would I set to simulate the cancel_at_period_end = false behavior?
I tried experimenting with the end_behavior but this only lead to: "No upcoming invoices for customer"
A req_xxx ID is helpful
You probably want to set an phase end_date that matches the end of the current cycle: https://docs.stripe.com/api/invoices/upcoming#upcoming_invoice-schedule_details-phases-end_date
Remove the other phases too and ensure the end_beahvior is cancel: https://docs.stripe.com/api/invoices/upcoming#upcoming_invoice-schedule_details-end_behavior
unfortunately I still get "no upcoming invoices for customer"
req_4R2lTpBbcOq4Ek
when I set end_behavior to "release" I get an upcoming invoice but the wrong one
Seems expected as you're cancelling the schedule at the end_date is ~now. In effect there's no future invoices. You want to prorate on cancel yes?
following example scenario:
product price is 100 / year
customer pays for a 3 year subscription in advance at a discounted price for 250 / 3 years
after 3 years the subscription should go back to yearly invoicing at 100 / year, we use the subscription scheduler for that.
to display the upcoming invoice (date and amount) we use the upcoming_invoice endpoint.
we also want to retrieve hypothetical upcoming invoices if the subscription is to be canceled at period end (achieved with the cancel_at_period_end = false parameter, which doesn't work if a schedule is involved)
so in the example above. customer paid for a 3 year subscription on 01.01.2025, next invoice is after 3 years at 01.01.2028 for 100, we want to get that information regardless if the subscription will run out or not
Hey! Taking over for my colleague. Let me catch up.
Sorry for my late reply, I was exploring the options here..
I'm not seeing any option for achieving this natively..
You probably need to display that information using your integration
Because you are using a yearly price
and not a 3 yearl price.
well, we are using a 3-year price that updates to a 1-year price when the 3 years are over