#Hackerman

1 messages · Page 1 of 1 (latest)

haughty thistleBOT
nova harbor
#

Could you share the code on how the subscription schedule is created?

lavish tiger
#

Yeah

#

phases

nova harbor
#

I see that you created two subscription schedules in your code. For creating subscription schedule on the existing schedule, the flow should be:

  1. Create subscription schedule with from_subscription: https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#existing-subscription
  2. Update the subscription schedule created in Step 1 with new phase that will change the price in the future date: https://stripe.com/docs/api/subscription_schedules/update

In the second subscription schedule creation of your code, you're actually creating a new subscription with subscription schedule. This is not necessary.

lavish tiger
#

In the example code of the official website .update is never used

nova harbor
#

The example code here is to create a new subscription with subscription schedule. I understand it's a bit confusing, but this example is not to have a subscription schedule with existing subscription

lavish tiger
#

One question, if I have a subscription running on a 6-month cycle. When updating the phases should I subtract that month that is currently running?

#

I need to charge 6 months and I already charged the first therefore the phases should be 5 iterations instead of 6, right?

nova harbor
#

When you create a subscription schedule, the first phase will be current phase and has no visibility of the number of cycles that have been processed in the past.

lavish tiger
#

Ok thanks, i go to test

#

The start_date should be the end date of the current phase?

nova harbor
lavish tiger
#

Ok wait

lavish tiger
#

req_3YREQLOt79XLp8?t=1676604944

#

Works!!

#

Ty

nova harbor
#

Is it working now? Or do you still have questions for req_3YREQLOt79XLp8?

lavish tiger
#

Add the missing parameter and it worked perfect

nova harbor
#

Woohoo! Happy to hear that 😄