#spera_api

1 messages ยท Page 1 of 1 (latest)

shy axleBOT
#

๐Ÿ‘‹ 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.

lament garden
#

๐Ÿ‘‹
Yeah you should remove the subscription_cancel_at_period_end parameter

distant pasture
#

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)

lament garden
#

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.

distant pasture
#

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

shy axleBOT
covert maple
distant pasture
#

how would this endpoint factor in the cancel_at_period_end = false behavior?

covert maple
#

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

distant pasture
#

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?

covert maple
distant pasture
#

I just found this parameter in the docs:
subscription_details.cancel_at_period_en

gonna try it

covert maple
covert maple
#

You need to use schedule and schedule_details when the sub is controlled by a schedule

distant pasture
#

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"

covert maple
#

A req_xxx ID is helpful

distant pasture
#

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

covert maple
distant pasture
#

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

lament garden
#

Hey! Taking over for my colleague. Let me catch up.

lament garden
#

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.

distant pasture
#

well, we are using a 3-year price that updates to a 1-year price when the 3 years are over

shy axleBOT