#Vinz
1 messages · Page 1 of 1 (latest)
Hi 👋
What is the issue you are encountering?
Even if all my items are in self.items_no_proration, the modification is fired right now
def update_stripe_subscription(self):
if self.items_proration:
stripe.Subscription.modify(
self.subscription.stripe_id,
proration_behavior='always_invoice',
proration_date=int(timezone.now().timestamp()),
items=self.items_proration
)
if self.items_no_proration:
stripe.Subscription.modify(
self.subscription.stripe_id,
proration_behavior='none',
items=self.items_no_proration
)
and an invoice is paid
This will always happen if the billing periods are different. We call this out in our docs
If the prices have different billing periods, the new price is billed at the new interval, starting on the day of the change. For example, switching a customer from one monthly subscription to another does not change the billing dates. However, switching a customer from a monthly subscription to a yearly subscription moves the billing date to the date of the switch.
and the subscription switch from yearly to monthly now instead of the end of current_period
Correct. Currently the best way to handle this, if you want the change to occur in the future, is to use Subscription Schedules.
https://stripe.com/docs/billing/subscriptions/subscription-schedules
OK, so let me clarify, I should have 3 cases :
- one proration for event I want to happen right now
- no proration for event with same billing periods
- one schedule for event with different billing schedule I want to happen at current_period_end
instead of the only 2 I've shown you
I'm not sure what that means: "I should have 3 cases".
What case isn't working as you expect?
I build stripe subcription items regarding the API and fire the modifiction like that
if self.items_proration:
stripe.Subscription.modify(
self.subscription.stripe_id,
proration_behavior='always_invoice',
proration_date=int(timezone.now().timestamp()),
items=self.items_proration
)
if self.items_no_proration:
stripe.Subscription.modify(
self.subscription.stripe_id,
proration_behavior='none',
items=self.items_no_proration
)
I never build a schedule
when I switch from yearly to monthly I have an invoice now instead of in one year
Right. That is what will happen when you change billing periods. The only way you can avoid it is to use Subscription Schedules to schedule the change from year to month prices
You can create Schedules from existing Subscriptions. This may help you handle that specific use case.