#worming_best-practices
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/1403417626176127057
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- worming_subscription-lineitem, 17 hours ago, 10 messages
- worming_api, 3 days ago, 31 messages
- worming_best-practices, 3 days ago, 16 messages
We’re trying to simulate the invoice that would be generated when updating a subscription where all items change from monthly to yearly billing.
We’re using the InvoiceService.Upcoming endpoint and passing the subscription, the updated list of subscription_items (with new yearly prices and quantities).
We are not using SubscriptionSchedule, and we’re not enabling flexible billing mode, since we are replacing all items at once and the billing interval is consistent across all items.
However, we’re getting the following error:
"All prices on a subscription must have the same recurring.interval and recurring.interval_count unless flexible billing mode is enabled and you're on the 2025-06-30.basil API version or later..."
Can you confirm whether this approach is correct for simulating a full upgrade from monthly to yearly using the Upcoming endpoint?
(We are using the .Net 48.0.0 SDK version)
It might be worth exploring our create_preview endpoint, though I am unsure if it will run into the same limitation. I'll need to test it
https://docs.stripe.com/api/invoices/create_preview?lang=curl&api-version=2025-02-24.acacia
The CreatePreview method is not available in the version of the Stripe .NET SDK we're currently using
My apologizes. Let me see if we have any other options for this.
This is what we are doing:
public Invoice GetUpcomingInvoice(string stripeCustomerId, string stripeSubscriptionId, List<NewPriceItemConfig> newPriceConfig)
{
var invoiceService = new InvoiceService();
var upcomingOptions = new UpcomingInvoiceOptions
{
Customer = stripeCustomerId,
Subscription = stripeSubscriptionId,
SubscriptionProrationBehavior = "create_prorations",
SubscriptionBillingCycleAnchor = SubscriptionBillingCycleAnchor.Now,
SubscriptionItems = new List<InvoiceSubscriptionItemOptions>()
};
foreach (var item in newPriceConfig)
{
var invoiceItem = new InvoiceSubscriptionItemOptions
{
Quantity = item.ToQuantity,
Price = item.ToStripePriceId
};
upcomingOptions.SubscriptionItems.Add(invoiceItem);
}
return invoiceService.Upcoming(upcomingOptions);
}
This is the error we are getting:
All prices on a subscription must have the same recurring.interval and recurring.interval_count unless flexible billing mode is enabled and you're on the 2025-06-30.basil API version or later. To proceed, update the subscription to flexible billing mode, then retry this update. For information about flexible billing mode, go to https://docs.stripe.com/billing/subscriptions/billing-mode. If you meant to update an existing subscription item instead of creating a new one, make sure to include the subscription item ID in your request. See examples at https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#changing.
We’re assuming that by sending only new SubscriptionItems (without specifying existing item IDs), the previous subscription items will be removed and replaced with the new ones.
Do you have a request id?