#Vinz

1 messages · Page 1 of 1 (latest)

tacit swallowBOT
quick pulsar
#

Hi 👋

What is the issue you are encountering?

vivid sinew
#

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

quick pulsar
#

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.

vivid sinew
#

and the subscription switch from yearly to monthly now instead of the end of current_period

quick pulsar
vivid sinew
#

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

quick pulsar
#

I'm not sure what that means: "I should have 3 cases".

What case isn't working as you expect?

vivid sinew
#

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

quick pulsar
#

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

vivid sinew
#

OK, I'll work on it

#

thanks

quick pulsar
#

You can create Schedules from existing Subscriptions. This may help you handle that specific use case.