#stiggz_api

1 messages ¡ Page 1 of 1 (latest)

lofty magnetBOT
#

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

📝 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.

waxen topaz
#

Hello is proration_behavior set to always_invoice in your call? That sounds like it is previewing the next invoice on the subscription if the proration items are charged in the future as opposed to now

acoustic flint
#

Let me see if setting that changes anything

#

Yes! That appears to fix it :D

#

Thank you!

#

Just to make sure I have it straight - I can make this call, which will show the correct prorated amount due immediately when I call the corresponding updateSubscription endpoint, right?

#

Here's the corresponding update call:

await stripe.subscriptions.update(subscriptionId, {
    items: [{
      id: 'subscription_item_id', // ID of the subscription item to update
      price: newPriceId,
    }],
    proration_behavior: 'create_prorations',
  });
waxen topaz
#

Great to hear! For the subscription update call you will want to specify always_invoice as well. create_prorations tells us to create invoice items for the proration now but add them to the next invoice on the subscription. always_invoice tells us to create an invoice for the proration and charge immediately.
One other thing to keep in mind is that we use the current timestamp by default when you make those calls. Here that can mean that the preview price and actual price can differ a bit if you make them minutes apart. The common workaround for this is to save the created time on your preview invoice and pass it as the proration_date when making your update call, that way the preview and update amounts are consistent. https://docs.stripe.com/api/subscriptions/update#update_subscription-proration_date

acoustic flint
#

Ok awesome! Thanks so much for your help