#wullvie_api

1 messages ¡ Page 1 of 1 (latest)

unborn coralBOT
#

👋 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/1331713419610423357

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

astral hare
#

Hello there

#

You are using the Create a Preview Invoice endpoint here?

hollow cloak
#

yup

#

technically the issue is not that the code /api is giving me wrong information. it

#

it's showing me the same thing i see in the test dashboard when manually editing the subscription

#

I want the preview to be able to tell me: A) your new item(s) will be the yearly subscription ($5,100 usd /yr), B) you have $0.00 due now (from the free trial days remaining), and C) on Feb 13, 25 you will be billed the 5100

astral hare
#

Yeah you are going to have to deduce some of that from the preview -- it won't return you all of that information explicitly.

hollow cloak
#

it gives me exactly that though when going from monthly to monthly

#

due now 0, after trial the new $ starts at 2/13 etc

astral hare
#

What does going from monthly --> yearly show exactly?

hollow cloak
#

so in the screenshot that's going from monthly to yearly, which visually shows the info I am getting from the api, but it's misleading / confusing i thikn

#

here's what i see in the dashboard going from monthly to monthly

#

the mo to yr change showing "amount due: 0" "bills immediately for 1 year" is strange to interpret. seems to be suggesting the client would be billed $0.00 for 1 whole year, where it really will be $0.00 until the trial ends, then it should be the new yearly sub price billed when the trial ends on Feb 13

astral hare
#

So technically the next Invoice will be $0

hollow cloak
#

oh specifically interval changes are the cause here ok

astral hare
#

So yeah the Preview isn't going to be great for this and you'll need to look at the other properties to display the correct info to your customer.

hollow cloak
#

ok so staying the same interval is going to give me what I'm expecting. that actually makes sense i guess an interval change is unique so I'll break it down differently

#

this way regardless or $ going up or down, or how it's prorated, same intervals vs. different intervals should both be consistent

#

Would you happen to know of top of ur head if I can pull this info from the preview? or should i try running a next invoice fetch or something for interval changes

astral hare
#

When you say "pull this info" what are you referring to specifically?

hollow cloak
#

sorry lol - when running an invoice preview request that has an interval change (like this example mo -> yr), would the information I need be nested somewhere in the preview response? (even through an expanded property is fine) or would I need to run another request to get a future invoice or something

#

information i need - meaning data that I can display to my client that shows 0 due now, and then (in this case) 5100 will be the amount billed after the trial is up, Feb 13

#

from the first screenshot I sent, I would need more info than what the dashboard UI is showing in the summary. I can "infer" that the 5100 will be billed after the trial, but I would feel more comfortable seeing that in the response itself

astral hare
#

I see, thanks for clarifying.

unborn coralBOT
astral hare
#

Hmmm, what does lines.data show you? Do you still see the line_items even for the trialing Invoice or it just indicates Trial there? I can't remember.

#

Otherwise, you can expand subscription and that should show you that info

hollow cloak
#

in the preview response, and lines data, going from the mo -> yr change, it shows 1 item: "Trial period for .... yearly subscription", the period start is the original subscription start (jan 16) and the period end is Feb 13

astral hare
#

Gotcha

#

What happens if you expand subscription?

#

Does it show the updated items?

hollow cloak
#

same thing for current_period_start and ...end same vals

#

one sec

#

here's the req id for the preview: req_gqI9LHnZ1eWJui

astral hare
#

Oh yeah that looks like it will work

#

So you can look at the subscription.items.data[0].price

#

Which would indicate the specifics of that Price like amount and interval

hollow cloak
#

so there's no explicit "timestamp" telling me the end of the new yearly invterval period? the period in which the user will actually have paid for

astral hare
#

You want trial_end for that

#

subscription.trial_end

hollow cloak
#

on the extended sub ok i see that. so at trial_end they will be billed the new yearly sub price?

astral hare
#

Yep

hollow cloak
#

ok. then from trial_end, is the interval 1 year from that date, or from the original (Jan 16 here)

astral hare
#

One year from the trial end

hollow cloak
#

ok cool

astral hare
#

I'd recommend using Test Clocks to test all of this out end to end

hollow cloak
#

that's what i would want anyway just checking

#

ok thanks for the help - i'll just make sure to add these extra few steps when the interval changes and it should be all good