#tobe_subscription-proration

1 messages ยท Page 1 of 1 (latest)

twin meadowBOT
#

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

tulip panther
#

Also, this is the same question from yesterday - that thread was just closed before I could respond this morning.

broken thunder
tulip panther
#

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

broken thunder
tulip panther
#

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?

twin meadowBOT
true fjord
#

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

tulip panther
#

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?

true fjord
#

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)

tulip panther
#

So that's not what subscription_proration_date does - indicate that the changes whould happen at the time specified?

true fjord
#

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)

tulip panther
#

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 ๐Ÿ™‚

true fjord
#

ah yeah I forgot we had both

tulip panther
#

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!