#andrea-skuola - subscription schedule payment intent

1 messages · Page 1 of 1 (latest)

versed badge
#

Hello, are you able to successfully create subscription schedules here?

#

The schedule should have a subscription property, that subscription will have a latest_invoice, and that latest invoice will have a payment intent as long as it is finalized and more than $0

molten estuary
#

yes the schedule has subscription property but in latest_invoice object there is the payment_intent set to null, why?

versed badge
#

Can you send me the ID of that invoice?

#

It is likely because the invoice is not yet finalized or because it has an amount of 0

molten estuary
#

in_1LIuaeK6jaF9EpCmm6KaAb4u

versed badge
molten estuary
#

and when it comes out of the draft state?

#

or how can I change its status

versed badge
#

It looks like auto-advance is enabled for that invoice so it should happen an hour after the invoice was created which should be about 30 minutes from now

#

If you want to test this faster, we have test clocks to simulate time passing. Let me find a doc on that

molten estuary
#

No, I need payment_intent because i have to create the payment_element , so the invoice need to be opened immediately

#

not in 30 minutes

versed badge
#

Looking in to that again. That is the first invoice for that subscription so I am surprised that it didn't finalize immediately

molten estuary
#

me too

#

i wanted the same behavior of subscriptions->create

#

that immediately creates the invoice with payment_intent

versed badge
#

Right, I think that should still be possible with a schedule. Looking in to this...

molten estuary
#

thanks a lot

versed badge
#

I am not having much luck finding what is happening here. I will reach out to a colleague for help and get back to you with what we can find.

molten estuary
#

thanks, i will wait here

versed badge
#

From what I can see, this is how it will work if the subscription is created from a schedule. Here you might want to create the subscription, create the schedule off of it, and then set the phase to end after two cycles if you need the invoice to finalize immediately.

#

I can put in a feature request to allow you to specify this from the schedule but unfortunately it looks like that is not possible at the moment.

molten estuary
#

how do i create the schedule from an existing subscription?

molten estuary
#

there is no subscription id to pass? how do you know which subscription is to be scheduled?

versed badge
#

You would make a subscriptions->create call first, then pass the ID from the subscription that that creates

molten estuary
#

yes but in the link you sent there isn't a subscription id field

#

how to attach the created subscription to its schedule?

versed badge
#

that would go in the from_subscription argument in the call to create the schedule

#

subscriptions->create would create sub_123 and then in subscriptionSchedules->create you pass sub_123 to from_subscription . That will create a schedule that manages sub_123

#

Does that help or am I still not quite getting your question?

molten estuary
#

ok, the fiels from_subscription there wasn't in the link you sent so i dont understand

#

now i understand

versed badge
#

Ah gotcha, glad we could clarify. I tried linking to a specific section of the doc but that may not have worked here

molten estuary
#

i'm using from_subscription field, but i got this error:

#

You cannot set phases if from_subscription is set.

#

how can i set iterations if i can't set phases?

#

i'm trying to schedule only for handle the iterations 😅

#

i'm trying to make another API call when schedule is already created, and trying to modify it

versed badge
#

I think that this will need to be 3 API calls:

  1. Create the subscription
  2. Create a schedule for the subscription
  3. Update the phases on the schedule
#

You can't edit the phases when creating the schedule but you can edit them after it is created

molten estuary
#

exactly