#beastboy_code

1 messages ¡ Page 1 of 1 (latest)

reef jettyBOT
#

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

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

zinc hazel
#

I run this function when the user has already paid for the old product, and now we need to switch them to a new product - so we can charge / refund them appropriately and then ship the product to them

#

So this is assuming they've paid already - so we can directly refund them or charge them the difference

worn solstice
#

Good question, looking in to how you can do this.

zinc hazel
#

thank you!

worn solstice
#

I think what you will want to do is specify proration_date as the beginning of the subscription's current cycle. I think that would mean we would calculate prorations as if the new price had been the subscription's price for the entire cycle https://docs.stripe.com/api/subscriptions/update#update_subscription-proration_date

zinc hazel
#

but I already do that with current_period_start

worn solstice
#

Whoops sorry, I did not look it over that closely. What does the invoice look like when you run that now?

zinc hazel
#

When I run this, it immediately charges the customer for the new product

worn solstice
#

Oh so the calculated amount is correct, but you want the update to be delayed until after the payment has been made?

zinc hazel
#

yes exactly

worn solstice