#beastboy_code
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/1314687844375334962
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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
Good question, looking in to how you can do this.
thank you!
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
but I already do that with current_period_start
Whoops sorry, I did not look it over that closely. What does the invoice look like when you run that now?
When I run this, it immediately charges the customer for the new product
Oh so the calculated amount is correct, but you want the update to be delayed until after the payment has been made?
yes exactly
Gotche, then you should just need to add payment_behavior: 'pending_if_incomplete', to your call (I did check if it was in your original code this time)
https://docs.stripe.com/billing/subscriptions/pending-updates