#tobe_subscription-proration
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/1304480344032022639
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- tobewisebeforeiamold_code, 11 hours ago, 4 messages
Also, this is the same question from yesterday - that thread was just closed before I could respond this morning.
Hi, can you share the subscription id with me? What are you really trying to do? When you make the retrieve call, https://docs.stripe.com/api/invoices/upcoming whar parameters are you passing?
I was trying to preview the cost of the subscription change.
const stripeSubscriptionID = 'sub_1PnOfPFXc3zoUgUu70C7uW2D'; // the archived $395
const existingSubscription = await stripe.subscriptions.retrieve( stripeSubscriptionID );
if ( existingSubscription ) {
const invoice = await stripe.invoices.retrieveUpcoming( {
customer: 'cus_Khj9IAsXJbhsAi', // planner pants
subscription: stripeSubscriptionID,
subscription_items: [
{
id: existingSubscription.items.data[ 0 ].id,
price: 'price_1QIf6fFXc3zoUgUulMZbMnE3', // annual premium on demo
},
],
subscription_proration_behavior: 'always_invoice',
subscription_proration_date: Math.floor( Date.now() / 1000 ),
} );
console.log( invoice.total );
}
Those are "test mode" IDs, and so I beleive they are not "sensitive information"
Node 18, Stripe 15.12.0
This is the same price, so why would you expect prorations? This would work if you're attempting to change the price to a different amount, https://docs.stripe.com/billing/subscriptions/upgrade-downgrade
But the subscription is 3 month old.
So if I have a yearly $395 subscriotion, then change it to another yearly $395 subscription on say 364, it's a free year for me?
I guess I'd expect my next invoice.total to show what I'd be paying, not just that at renewal there'd be no change from what I'm currently paying.
Also, doesnt' subscription_proration_date=now mean (in seconds) mean we're invoicing now? So wouldn't that reset the billing anchor, starting a new invoice, thereby shifting the value of the preexisting invoice into credit towards the new invoice?
tobe_subscription-proration
@tulip panther in the example you gave, nothing changes, the new Price will be charge the next day for the whole year
Maybe if I explained the problem I'm having a different way it might make more sense. We have two products: A and B. Subscription A has fewer features than B. There's an archived price in subscription A that happens to be the same dollar amount as the price of Subscription B.
What we're trying to do is show the user what it would cost if they immediately ended their current subscription (archived price of subscription A) and immediately began their new subscription B.
Doesn't the 9 months left from the subscription with that archived price count towards their new subscription?
Gotcha, you forgot to pass https://docs.stripe.com/api/invoices/upcoming#upcoming_invoice-subscription_billing_cycle_anchor to now
What you are doing with your code is switching from A to B, keeping the same existing billing cycle and charging for the price difference between A and B for the remaining time (and they are the same cost so nothing to pay)
So that's not what subscription_proration_date does - indicate that the changes whould happen at the time specified?
Your understanding of what that parameter does is incorrect, yes. Though the way you word it is correct, but you understand it different.
subscription_proration_date allows passing a specific timestamp so that the proration is "stable" between when you preview it and when your customer really pays (a few minutes laterr for example where the math could have changed)
OK, so then I'd specify both subscription_proration_date and subscription_billing_cycle_anchor for both the preview of the cost and the actual updating of subscription, and that may solve the descrepancy I'm seeing?
That page you referenced seems to indicate that subscription_billing_cycle_anchor is deprecated, BTW. looks like that's changing to subscription_details.billing_cycle_anchor I'll try that for future compatibility ๐
ah yeah I forgot we had both
Ah, that looks much better! Now I'm seeing a value of $94.12, which sounds about right for 3 months of $395! Thank you!