#birdy247
1 messages ยท Page 1 of 1 (latest)
We seem to be making far too many API calls and its taking 5/6 seconds to prepare things
1/ create customer
2/ create subscription schedule
3/ Finalise the invoice
4/ Update the payment intent for off_session usage
4 Api calls just to get the necessary payment intent secret
Can this be optimised?
Hello?
๐ Hi there, Happy to help!
Can you see my messages above?
yes I'm on it
Thanks
Why are you doing step 3 and 4?
I may suggest you to follow this guide on how to build subscription:
https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
You can replace the subscription API creation call with a subscription _schedule API creation request
4 Api calls just to get the necessary payment intent secret
For example this step can be done at the same time while creating the subscritpion_schedule, by expanding the responselatest_invoice.payment_intent, then you'll get the client secret directly
I tried that
But the invoice had a null payment_intent
because it wasnt fianlised
This is a subscription schedule
On subscriptions, we can pass 'payment_behavior' => 'default_incomplete',
But it seems different on subscription schedules]
You are right let me do some tests please
Thanks for your patience,
One of the option and if you pricing model allows it, at the beginning you can create a subscription (which reflect the first phase of your subscritpion_schedule) then asynchronously you create a subscritpion_schedule from the subscription, and then you do the necessary updates in order to get the target subscritpion_schedule
https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-from_subscription
or you can keep your first logic, and do those steps asynchronously if your UX design allows that: like you don't collect all the information of the customer, the subscription, the plan in a single large form, but you do it in a seperate forms. Then after each step you do asynchronously one of the calls in order to not let the user waits at the ends 5/6 sec
Hi, sorry, just returning here
@prime stratus Did you have a Q?
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!