#andrea-skuola - subscription schedule payment intent
1 messages · Page 1 of 1 (latest)
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
yes the schedule has subscription property but in latest_invoice object there is the payment_intent set to null, why?
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
in_1LIuaeK6jaF9EpCmm6KaAb4u
That invoice is still in a draft status. Once it transitions out of its draft state it will have a payment intent https://stripe.com/docs/invoicing/overview#invoice-lifecycle
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
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
Looking in to that again. That is the first invoice for that subscription so I am surprised that it didn't finalize immediately
me too
i wanted the same behavior of subscriptions->create
that immediately creates the invoice with payment_intent
Right, I think that should still be possible with a schedule. Looking in to this...
thanks a lot
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.
thanks, i will wait here
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.
how do i create the schedule from an existing subscription?
https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#existing-subscription
there is no subscription id to pass? how do you know which subscription is to be scheduled?
You would make a subscriptions->create call first, then pass the ID from the subscription that that creates
yes but in the link you sent there isn't a subscription id field
how to attach the created subscription to its schedule?
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?
ok, the fiels from_subscription there wasn't in the link you sent so i dont understand
now i understand
Ah gotcha, glad we could clarify. I tried linking to a specific section of the doc but that may not have worked here
i'm using from_subscription field, but i got this error:
You cannot set
phasesiffrom_subscriptionis 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
I think that this will need to be 3 API calls:
- Create the subscription
- Create a schedule for the subscription
- 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
exactly