#smock
1 messages · Page 1 of 1 (latest)
Hi there
hi
Can you provide a specific example that you are testing with and explain what you would like to happen
Then I can see if it is possible and if there is any workaround
sure yep, I got to example customers I can link if that helps, not sure if you can view data in my test account, or I can post screenshots
sure yep, so first this is the "normal" scenario, the subscription has not been discounted; the base price is $21 and additional units cost $1
sub_1LpibiAlWOZ9EtFQVDFSJ4zC
so in this case we did a prorated upgrade right at the start of the and it charged the customer $1 as expected (for both the first and second invoice)
and this is the "problem" scenario
same sub and pricing, but this time when the customer purchased the subscription, they had a one-off discount of 99% applied, and the second invoice charges them $21.79 after a prorated upgrade, because the time remaining is only counted as $0.21, we would expect it to also charge $1
sub_1LpJCKAlWOZ9EtFQgEaDFusw
so invoice in_1LpJDwAlWOZ9EtFQxliqJUJG specifically is what I am having trouble with
Gotcha
Okay so yeah proration will always take the discount into account. If you don't want that to happen, then the workaround here is to preview the proration for the upcoming invoice using https://stripe.com/docs/api/invoices/upcoming where you would not have a discount set (you pass coupon with an empty strting). Then you create a one-off invoice item for that amount, and perform the Subscription update with setting proration_behavior: none.
ah ok
ok just one more thing if you dont mind, i cant quite see it in the API docs
is there a way to tell if a customer/last invoice has had a one-off discount applied?
cos ideally we would only want to do this in that scenario as all the other scenarios work perfectly for us
Yep, if you are setting coupons at the Customer level then you either retrieve the Customer and check the discount object: https://stripe.com/docs/api/customers/object#customer_object-discount. Or you retrieve the Subscription and expand the latest_invoice: https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice
ok awesome, thanks so much for clearing that up for me. Very much appreciated