#jimmy-sandoval
1 messages ยท Page 1 of 1 (latest)
Hello! How can I help?
Hi @willow stirrup
I have a customer that has a subscription, but this customer cancels their subscription at the end of cycle
I updated your subscription with API
https://stripe.com/docs/billing/subscriptions/cancel?dashboard-or-api=api#cancel-at-end-of-cycle
I using this process for cancelt at the end of cycle
so far do you understand me?
In conclusion, I have a user whose subscription will be canceled at the end of the cycle
I have a UI to simulate how much the user will pay if the amount of his subscription increases or decreases, and for that I consult the upcoming invoice api to show the user how much he will pay
So, when the user enabled his subscription to be canceled at the end of the period, I can no longer retrieve the next invoice, I get an error: No upcoming invoices for customer: cus_NcK54lHWSGoHca
@willow stirrup ๐
๐ hey there - give me a minute to dig in
Yeah that error makes sense - if a subscription were to cancel at the end of the current period there would be no additional invoices
What behavior were you expecting instead?
How can I tell you again, in my business if a client cancels their subscription at the end of the period
we want to renew
but if you only want to lower or raise the amount that has the same subscription
give me a minute
we want to enable the subscription to tell us about the prorate again
We want that if, for example, your current subscription that is going to be canceled at the end of the cycle, has 10 quantity of a $10 Kuelpa plan
What happens if I want to reduce the quantity to 5, or increase the quantity to 15 and apply a proration
So you want to preview what the next Invoice would look like if they made a change to the quantity AND didn't cancel at the end of the period. Right?
I mean, I want to get a preview of what the next invoice would look like if they made a change in the amount, knowing that the subscription will be canceled at the end of the cycle
When you make the changes to amount if your goal to Invoice for those changes immediately?
yes
one option is to disable cancel_at_period_end
and so I can recover the preview of the invoice
but I wanted to know if there is another way
Gotcha - that's the important piece you were missing. If you want to preview the Invoice from making changes and prorating immediately you need to pass in subscription_proration_behavior: always_invoice with the changes (https://stripe.com/docs/api/invoices/upcoming_invoice_lines#upcoming_invoice_lines-subscription_proration_behavior)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
give me a minute please
i will probe
No, i have the same error
I doing this for retrieve upconming invoice
It's because you're not actually passing in any of the change you're trying to "preview"
Have you read these docs? https://stripe.com/docs/billing/subscriptions/prorations#preview-proration
If you want to preview updating the Subscription you need to pass in things like subscription_items with the request that reflects all the changed items
๐