#jm199seo-subscriptions
1 messages · Page 1 of 1 (latest)
@flint marsh hmm well usually you keep the item but change the Price on it.
that's why in the example at https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#switching it does :
items: [{
id: subscription.items.data[0].id,
price: 'price_CBb6IXqvTLXp3f',
}]
for example, that changes the Price on that item to the new one, it doesn't append a new item with the new Price
it's something people commonly miss(passing the id of the existing item).
not sure I completely follow your question. Are you maybe just asking how to only remove/replace the item at the end of the current billing cycle or something?
what i experienced when I passed the id was that the usage transferred over to the new price, which is not applicable for my situation.
I'm trying to preserve the old price with the old usages + new price with new usages for 1 billing cycle and then remove the old price from the subscription after customer payment/invoice.
ah ok
then yes you are wanting to remove the old price at the end of the period. There's no straightforward way to do it unfortunately! The options are basically:
- call the API again at the start of the next billing cycle(you can listen to the
invoice.createdwebhook event, orcustomer.subscription.updatedto detect that) and remove the other item - use the SubscriptionSchedules API to configure a phase that removes the item automatically (along the lines of https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#upgrading-subscriptions)
would a better solution be creating a new subscription and canceling the old subscription at the end of the billing cycle? or do you suggest keeping the subscription and just modifying the items inside it?
- call the API again at the start of the next billing cycle(you can listen to the invoice.created webhook event, or customer.subscription.updated to detect that) and remove the other item
I think this can be handled by voiding any subscription items withoutlookup_keys after a webhook event