#websiddu

1 messages ยท Page 1 of 1 (latest)

timber riverBOT
reef laurel
supple mesa
#

Wait, why doesn't stripe.invoices.retrieveUpcoming work?

reef laurel
#

it does work,

#

but I have to manually calculate the Amount due today

#

by subtracting from each line items

#

in the strip dashboard, the preview is super celar, like shown in the image.

#

And I see in strip dashboard, this is the request sent.

supple mesa
reef laurel
#

is there an equivalent API call that I could use.

supple mesa
#

I'm not sure I understand. The API you're using returns a total with all the same line items you would see in the dashboard

reef laurel
#

I'm not sure if that is true for me ๐Ÿ˜ฆ

supple mesa
#

What do you mean? It's right there in your screenshot

reef laurel
#

the screenshot is from Strip itself

#

its devtools from strip dashbaord,

supple mesa
#

Got it. That's exactly what the payload will look like when you retrieve an upcoming invoice as well

reef laurel
#

but when I send the request, in my app,

#

and passing a subscription_proration_date

#

the response is not the same as what I have been seeing in the strip app itself,

#

so I have do my own math to figure out the amount due today when the user is updating the quantity of a subscription.

supple mesa
#

When you look at the upcoming invoice in the Dashboard, you're seeing what it will look like with no changes, but by passing in a subscription_proration_date you are getting a mock-up of what the Invoice would look like if you changed the proration date

#

Does that make sense?

reef laurel
#

Yes, the data accurate.

#

But I think, its just not in the right format to dispaly that subscription update preview

timber riverBOT
reef laurel
#

in the same way in when I update the quantity of a subscription from the dashboard.

supple mesa
#

So the data is correct but you want to know how to display it?

reef laurel
#

yes, I want to display the update preview like what strip dashboard is doing, when I update the quantity of a subscripotpn

#

I'm looking for a call that sends me data in that format. ๐Ÿ™‚

supple mesa
#

Got it, you would need to figure out how to display that on your own. Stripe doesn't provide an UI components that do that for you. The closest thing we have is the Customer Billing Portal (which wouldn't allow you to customixe subscription updates to this degree)

reef laurel
#

I'm more looking for an API call,

#

give a subscription quantiy change, that will provide me with amount due today

covert crest
#

The upcoming invoice endpoint is meant for exactly this kind of subscription update preview

#

What about the endpoint is not providing what you need?

#

Can you share an example request you're making, and the response body (redacting anything sensitive) to help me understand your challenge here?

reef laurel
#

Oh it does provide all the info, but I have to do math by myself

covert crest
#

What math?

#

The invoice has amount_due, right?

reef laurel
#

e.g Let's say, I have subsribed to 5 seats per $10 each currently, and I want chagne the seats from 5 to 2 in the middle of the month

covert crest
#

Ok, can you show me an example request where you get this change preview?

#

And then explain using the response you get what you need to calculate compared to what you get back?

reef laurel
#

In the strip portal, it give a clear view of what is being credited.

covert crest
#

I mean via the API

reef laurel
#

so I want to recreate this UI using API

covert crest
#

The UI you'd need to handle yourself, yes

#

but the data should all be available

reef laurel
#

e.g the text "Applied account balance" I have basically pick line item

#

from the updcoming invoice resopnse

covert crest
reef laurel
#

and display it by myself,

#

Sorry, If I were to display the line that say "Applied account balance" that piece of text is not present in the api response at all today.

covert crest
#

Can you share a specific example request & response data with a customer balance so we can look at the data together?

reef laurel
#

This is the response I get when I go from a 4 seat to 3 seat (each $15 per month)

So currently the customer is paying $60 per month, for 4 seats, and they want to change it to 3 seats moving forward, assuming they changed their mind quickly after paying, the new monthly amount they would pay is $45 per month and they will have a $15 credit, and today amount they pay right now is 0.

#

Here is the response i get

#

for the due today -> I use the amount_due,

#

not sure i get to show the credit

#

Other than doing subtraction by myself

covert crest
#

Well what are you expecting here? There is no amount due right?

#

Can you share the request you're making to get that?

#

But this seems expected

#

You're crediting back ~60 for the proration, charging ~45 for the proration, charging 45 for the next month, so the net is ~30

#

and the customer has ~90 balance, so ~30 is applied from that balance and now they have ~60 balance remaining (ending_balance)

#

if you want the prorated net before balance, that's subtotal=3030 here (or total, depending on whether you want with or without tax)