#andrew.cai

1 messages · Page 1 of 1 (latest)

real minnowBOT
midnight siren
#

I need to set the number of subscriptions in one cycle in advance for the next cycle

#

how can i do in api

desert comet
midnight siren
#

what is the start_date

#

this?

#

Is this to cancel the original subscription and re subscribe?

desert comet
#

The example in the doc is for creating a new subscription schedule without existing subscription.

For existing subscription, Update subscription schedule API should be used and start_date is not required to set: https://stripe.com/docs/api/subscription_schedules/update

Example request with updating subscription schedule:

{
  end_behavior: 'release',
  phases:[
    {
      items: [
        {price: 'price_xxx', quantity: 1}
      ],
      iterations: 1,
      start_date: subscription.current_phase.start_date
    },
    {
      items: [
        {price: 'price_xxx', quantity: 2}
      ],
      iterations: 1
    }
  ]
}
midnight siren
#

For example, these subscriptions this month are 0, and they will be changed to other quantities starting next month.

#

"subscription.current_phase.start_date" Is it a value or a meaning?

desert comet
#

Yup! You can set the with Subscription Schedule API by scheduling to update the quantity in next month

midnight siren
#

The usage scenario is as follows: starting from next month, billing will be based on the number of new subscriptions until the next time the number needs to be modified. Is this the step?
1、create a subscription schedule
2、update this schedule quantity

#

If the start_date is not set, it will automatically start from the next cycle, right

desert comet
#

Above steps are correct. The start_date will be using the start_date from the existing subscription if it's not set

midnight siren
#

ok, I'll try

#

how can i find the schedule on dashboard

desert comet
#

You should be able to see an icon displaying Update scheduled in the subscription page

midnight siren
#

Sorry, which interface is this screenshot, can you cut the whole picture?

desert comet
midnight siren
#

You cannot set phases if from_subscription is set.

desert comet
midnight siren
#

req_5llJVtULmq19Z7

desert comet
#

You can't add phases when creating a subscription schedule on existing subscription. The steps will be:

  1. Create a subscription schedule with only from_subscription
  2. Then update the phases with update subscription schedule API
midnight siren
#

ok

#

req_utcMoTsCPvlxWB

desert comet
#

As mentioned in the response, you'd need to set the iteration or end_date of the first phase. First phase is usually the existing phase. If you wish to end the currenct cycle as usual, then you can set the iteration of first phase to 1 and the quantity change in second phase will kick in next month.

midnight siren
#

After this iteration is set, will the quantity change back when the time is up?

#

req_o6caRXpR7g1Vdf

desert comet
#

For example,

  • Subscription is created with quantity of 1 for monthly price on 1 Jan 2023
  • Create subscription schedule and update the first phase (existing cycle) to iteration to 1 and second phase (next cycle) to 2
  • The quantity of existing cycle will remain as 1 and change to quantity 2 once the next phase reaches on 1 Feb 2023
#

I provided you an example above just now:

{
end_behavior: 'release',
phases:[
{
items: [
{price: 'price_xxx', quantity: 1}
],
iterations: 1,
start_date: subscription.current_phase.start_date
},
{
items: [
{price: 'price_xxx', quantity: 2}
],
iterations: 1
}
]
}

You'd need to set the start_date of the first phase to the start_date of current phase

midnight siren
#

req_iXwOjHe18Sgv6B

desert comet
#

you don't have specifiy start_date in the second phase. it'll pick up the end date from the first_phase

#

could you please have a look at the example request i shared above?

midnight siren
#

Is that mean?
phases[0] is current cycle
phases[1] is next cycle

desert comet
#

Yep, correct

midnight siren
#

If my current cycle does not need to be changed,
is still need to fill in phases[0].items?

desert comet
#

yes! current phase is required to set in phases[0]. you can retrieve it in the response when you create subscription schedule

midnight siren
#

ok i got it! thanks!

#

another question

#

Is there a pre quotation interface

#

like
how much will it cost if I modify the subscription quantity in the next cycle

normal bronze
#

👋 taking over here

#

I think you can use Upcoming Invoice API

#

passing in conditions and it will output a simulated Invoice based on the provided conditions

midnight siren
#

If there are documents, I can read them first, and then come to ask you if there are any questions later

normal bronze