#cCropster-subscription-proration
1 messages · Page 1 of 1 (latest)
sub_1Js6t1GjXM5VM2fZcwnQu9Ey
Thanks, taking a look!
You'll want to prorate when cancelling: https://stripe.com/docs/billing/subscriptions/cancel#canceling
Specifically, this parameter: https://stripe.com/docs/api/subscriptions/cancel#cancel_subscription-prorate
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The code I'm using to cancel the subscription looks like this:
SubscriptionCancelParams cancelParams = SubscriptionCancelParams.builder()
.setProrate(true)
.setInvoiceNow(true)
.build();
subscription.cancel(cancelParams, requestOptions());
The subscription you shared is still active, so difficult for me to confirm behaviour vs what you're seeing
Do you have a cancelled subscription?
This is a cancelled subscription: sub_1JuFnDGjXM5VM2fZIekkMxaa
Checking
To confirm, you're expect proration credit to be applied for the flat_amount?
Yes,
I cancelled the subscription I posted first. Same behaviour
Billing period is Nov 4 - Nov 23, 2021, Flat fee should be less than 5 EUR
Yep, looking into this
hmm, if you cancel the subscription and pass invoice_now, we just invoice for any uninvoiced usage, so the 654 usage. I don't think there's any concept of just charging some smaller amount based on something like the date it was reported.
so pretty sure we don't support what you're looking for(manually adding a discount or negative invoice item relating the amount of already-reported usage you don't want to charge for is probably the only way yes)
I don't have a problem with the amount calculated for the usage count.
My target is to adapt the flat fee amount based on the time the subscription was active.
If this doesn't work with invoice_now, does it work without invoice_now?
without invoice_now we just cancel the subscription without charging anything
I don't think you can get what you want here from any built-in options I'm afraid!
Does this also affects the first invoice that will be generated after billing cycle ended?
E.g. A new subscription is created today (23 November 2021).
The billing cycle end on 30 November 2021.
The flat fee amount will be still the full amount.
So, how do I get the flat fee amount of the price to calculate a discount inside our application?
I think I'd have to test it to know for sure. What does "The billing cycle end on 30 November 2021." mean exactly? Like is it a Price with recurring[interval]= weekly and it started on the 23rd and cycled 7 days later? In which case yes it's the full amount of the flat tier, why would it be anything else? If you mean, it's more like recurring[interval]=month and you manually reset the cycle on the 30th, then it would be affected by what value you pass to proration_behavior when updating the subscription to reset the cycle. I don't entirely know off the top of my head how/if proration works in this exact scenario though, I'd have to test it.
how do I get the flat fee amount of the price
https://stripe.com/docs/api/prices/object#price_object-tiers-flat_amount
The product/price remains the same (recurring[interval]=month). Stripe resets the cycle - no manual intervention.
I'll test the behavior and will hopefully report back - hopefully soon.
ah ok, so like a billing threshold being hit to force an invoice.
exactly
ultimately this is a really complicated usage of the product (metered+tiered+thresholds) so directly trying things in test mode is the only way to get a solid answer. My guess is the concept you're looking for doesn't exist in the product, the proration logic is not as nuanced as you'd want it to be I think.
I didn't expect it to be easy.
You're right, testing the use cases will give me clarity about the behaviour of the integration.