#Rob.Clayton

1 messages · Page 1 of 1 (latest)

little orioleBOT
pseudo frigate
austere kettle
#

req_wxXuat6YBeoNUF

#

basically I'm trying to import our existing subscriptions, and we will be asking the customer to renew before the cancel date (I'm going to add a subscription schedule that cancels at the end of their subscription period).

However they have already paid for their full year contract with us.

#

so I want to add the subscription, but not charge them in stripe

#

and they don't have payment methods or anything setup, because they are also new customers

#

This is my actual code:

pseudo frigate
#

Thanks for sharing. Looking into it now

austere kettle
#

Thanks

pseudo frigate
austere kettle
#

ah, thanks river, will try that

pseudo frigate
#

No problem! Happy to help 😄

austere kettle
#

oh, while I've got you ...
and that's working by the way, thanks.

How do I create a subscription schedule for the above subscription that cancels the subscription at a given date?

#

If I set a cancel_at field in the subscription create call ... does that actually create a subscription schedule behind the scenes?

pseudo frigate
austere kettle
#

Is there any difference in the behavior of the two methods?

pseudo frigate
#

There is no difference, but item (1) should be easier

austere kettle
#

thanks

If I did the second option, would I do something like this?

step 1:
schedule = stripe.SubscriptionSchedule.create(
from_subscription=subscription.id, api_key=self.api_key
)

#

so there's a phase that is I assume the same as whatever is in the subscription

#

step 2 ??? -
then do I ADD a second phase to start and end at the same time as the end of the first phase, and for the end_behavior to be "cancel"?

pseudo frigate
#

You can update the end_date of first phase with end_behaviour with cancel

austere kettle
#

how would I update the first phases end behavior with my code sample above?

#

When I create a subscription, and then create a schedule from the subscription there appear to be two phases created

#

this is my actual code:

pseudo frigate
austere kettle
#

right, that makes sense ...
just wondering why two phases are create if I just create a schedule based on subscription create example above?

little orioleBOT
nova torrent
#

I'd have to look at the sub_sched_xxx itself to say but maybe it's to do with using backdate_start_date and that leads to a previous phase being created that represents that when converted to a Schedule

austere kettle
#

ah, makes sense
so I assume actually all I need to do is set the end_behavior to be "cancel" with subscription schedule modify?

nova torrent
#

that could work yes, you can use that to say "after all the phases I've defined have ended, cancel the subscription"

austere kettle
#

hmmm ... no, so at the moment, if I create a subscription as described, if I then call subscriptionschedule.create(from_subscription=my_sub_id)
it creates the first phase to start today, and the end to be the end date I set, then there is a second phase which is for the following year

nova torrent
#

and that's not what you want?

#

again it would be easer if you could share an example sub_sched_xxx I could look at in parallel

austere kettle
#

This is my schedule create code.
start_date = '2023-06-11 06:30:30'
end_date = '2024-06-12 14:00:00'

#

the item is for a product billed yearly

nova torrent
#

easier to look at the specific sub_sched_xxx object you created in test mode for example, do you have the ID

austere kettle
#

this is the subscription id just created: sub_1NISRlLlJAiubLi9ploMAxD0

#

here's the schedule sub I just made:
sub_sched_1NIST9LlJAiubLi9fyur9hQa

nova torrent
#

thanks

#

so sure, you have a subscription that has a billng anchor set to 2024-06-12 14:00:00 next year with some backdating, so it creates a Schedule that represents the current state of the sub, which is one phase from the time the subscription was created today until that 2024 date, and then a next phase that starts at that date and ends a year later(since it's a yearly Price) and recurs forever beyond that (since it's end_behaiour:release)

#

so what do you want to do next

austere kettle
#

ahhhh, so the second state is the state that will be followed on going

#

got it

#

I want to actually cancel at the billing_cycle end date I set
I know I can set a cancel_at with the subscription, but was wondering how to do it with a schedule

nova torrent
#

you want it to cancel at that 2024-06-12 14:00:00 date?

austere kettle
#

yes