#Vdrizzle
1 messages ยท Page 1 of 1 (latest)
Hello
Can you give me the example where you are seeing the above?
Ha that is a funny coincidence
Yes so "I have" a subscription with 1 user seat for $39. I want to allow customers to change their sub and see how much they are going to get charge "right now"
Okay and are you using the upcoming invoice preview to help determine that?
Yes but, well you see the numbers I'm getting
{
"subscription": "sub_1Mf8yT2YF2woP7IMJcnt3VrF",
"subscription_items": [
{
"price": "price_1Mb7wv2YF2woP7IMPun4fuKy",
"quantity": 2,
"id": "si_NPywI0UA82BTmF"
}
],
"subscription_proration_date": 1677513561
}
this is the payload I'm passing
I would expect that if I have one seat @ $39 and I add another one "right now" I would get charged $39 or a prorated amount for the $39 from "now" up to the next monthly charge. Unless I'm not understanding well.
Let me take a look at that example
๐๐พ
Yeah okay
Looks like that Sub has multiple subscription items
So you are previewing for all of them
If you don't want to preview for all of them in your upgrade then you need to mark them as deleted in the preview
Ah they are
Missed that, thanks
Hmm
Can you show me the full JSON returned for the above request?
Yes, do you want it pasted here or a link to a pastebin or something like that?
kk
mmm is trying to paste as a .txt
maybe is too big
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I'll keep trying to paste it here
this is what discord is doing
Yeah that's fine
I think I see what is happening. It's adding the next invoice amount + what it would be due "today"
Ah shoot you aren't passing always_invoice
For proration_behavior
So yeah
Since same interval for Price it will be the next invoice
I see let me try that real quick
Nice
OmG โค๏ธ . Thank you so much. I thought for a second we'd have to do MATH ๐
lol glad it works
No worries
So this happens when I pass in the same qty. Any way I can make the system give me a $0 dollar amount or do I have to manage that
the pay load
{
"subscription": "sub_1Mf8yT2YF2woP7IMJcnt3VrF",
"subscription_items": [
{
"price": "price_1Mb7wv2YF2woP7IMPun4fuKy",
"quantity": 1,
"id": "si_NPywI0UA82BTmF"
}
],
"billingEntityId": "cos_11277",
"subscription_proration_date": 1677516360,
"subscription_proration_behavior": "always_invoice"
}
You want the preview to show $0 if you preview a no-op update?
Like previewing an update with the same line items that are currently associated?
Sorry had to jump in a meeting quick.
If possible I would like the invoice to say you owe $0 right now
essentially yes to both of your questions
Hi ๐
From what I can see the quantity of 1 is causing the $39 amount to be shown here, which makes sense based on the price. What is the reasoning behind showing a $0 amount?
Hi ๐๐พ
So the scenario here is a customer that already has qty of 1.
Basically I (customer) want to update my subscription and lets say I check how much I owe "now" for two but then I revert back to one etc.
Okay so the customer has already paid for the 1 quantity and you want to be able to check what the cost would be for a quantity of 2?
Sorta yeah
that is the use case
Don't mind the qty of 10 for social. That is a plan default that is not represented in stripe.
I'm expecting that if I pass a subscription_id and a subscription_item_id that match the qty that nothing would be due "now"
I'm trying to avoid having to preserve the original state locally in the UI to check if the customer is really previewing changes or not to short circuit the call to preview invoice. I hope that makes sense
Okay I see what you mean.
Looks like the line item being returned is for the next billing cycle even though I'm passing "always_invoice" with a proration date of "now"
What happens if you pass a timestamp value that corresponds to now?
To what field? proration date?
{
"subscription": "sub_1Mf8yT2YF2woP7IMJcnt3VrF",
"subscription_items": [
{
"price": "price_1Mb7wv2YF2woP7IMPun4fuKy",
"quantity": 1,
"id": "si_NPywI0UA82BTmF"
}
],
"subscription_proration_date": 1677520580,
"subscription_proration_behavior": "always_invoice"
}
This is essentially the payload
Ah, okay.
๐ Just hopping in here since snufkin has to head out soon
@slim stone You're using trying to use the upcoming invoices api to preview what would be owed immediately if there was no change made to the subscription, correct?
So the issue here is that if you were to make a request to update the subscription but make absolutely not changes, we wouldn't generate a new $0 Invoice for the Subscription
We'd consider it to be a no-op, keep the current Invoice, and then the Subscription will renew normally
That's why the upcoming Invoices API is giving you back an Invoice for the full amount - it's giving you the NEXT invoice that will be generated when the subscription renews (because no invoice is being generated for the no-op change)
๐ My suggestion would be to display the date and amount in your UI (so that if the changes are a no-op it'll be clear that the amount won't be charged today)