#brianp
1 messages · Page 1 of 1 (latest)
I don't know if what I have found is a bug or expected behavior which I need to account for.
That depends on how you want it to happen
You determine whether to prorate the customer when you update the subscription
For Customer on a trialing subscription that ends, it will create a draft Invoice. If the customer changes price at this point, their account is credited.
Yeah that is expected behavior. Stripe assumes you will collect payment on the invoice generated
The problem is that Customers can switch prices, get an amount credited to their account, and never have to enter payment. Their subscription remains active after the draft Invoice finalized and an attempt to charge is made.
But the Customer is only allowed to change the Subscription based on your configurations, You can adjust this behavior
Do you have a link to the documentation for this configuration?
Here are the public docs on the Customer Portal: https://stripe.com/docs/customer-management
And you control the proration behavior with this parameter: https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-features-subscription_update-proration_behavior
If I disable proration, will it create 2 Invoices. 1 for the draft Invoice for the previous price and 1 for the price which the Customer new price which the Customer switched to?
Do you mean the "trial" invoice? The always_invoice option means that a new invoice will be created for whatever charges have been incurred whenever a Customer updates their subscription. So if they are 1 day into a billing cycle on price X and change to price Y, they will get an invoice for 1 day on price X
Is the trial invoice the $0 Invoice?
Yeah. But that will still prevent the Customer from getting a credit for the price downgrade
I have "Prorate subscription updates" and "Issue invoice at the end of billing period" enabled under the Customer portal settings settings/billing/portal. I want prorations for when Customers switch plans during the middle of the billing cycle.
It just seems wrong that Stripe will credit accounts for draft Invoices which Customers did not pay regardless of the setting.
I was able to get a free 1 year subscription by changing prices.
That is something you can configure. And you can apply different configurations each time you direct a user to the Customer Portal
So do I need to check if the Subscription was "trialing" and became "active" and has a draft Invoice and change the proration behavior?
👋 stepping in as Snufkin needs to step away
If you are going to prorate by default, then yes. You would need to handle the above scenario
So there is another scenario which I can reproduce which allows me to abuse proration and bypass payment.
If a Customer's charge fails and their Subscription becomes past_due while they have a Customer portal session open, then can switch plans, get their account credited for the Invoice which they didn't pay, and their subscription remains active.
Sure
That is the default behavior
This is on you to handle
It all depends on how you want your integration to work
It is impossible to completely prevent nefarious actors with the default behavior here. If you are worried about that then you need to implement controls and configurations yourself for Customer Portal