#mckeemi_unexpected
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1230081198034911252
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- mckeemi_code, 5 days ago, 25 messages
- mckeemi_best-practices, 6 days ago, 13 messages
๐ happy to help
Thank you so much
that's the expected behavior
if you want to receive the invoice.paid before the hour span, you need to manually finalize the invoice
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thank you, so I have 2 phases in my subscription schedule ... an initial one (where the amount might be different), if I set it to manual in the setup would the remaining recurring payments in the other phase occur automatically?
I mean if I set the payment behaviour to manual in the first phase or can I do that?
I just not sure why the behaviour differs from CreateSubscription on the initial invoice
you don't have to put anything to manual
you keep the subscription schedule as it was
and you just finalize the first invoice
which makes the payment happen automatically
without waiting 1 hour
OK, so my flow would be:
Create the subscription Schedule & pass the clientsecret back to the UI
Display the card elements on screen (associated with the clientSecret)
Enter card details & confirm payment
yes
Do I finalize the invoice on receiving a webhook then
actually if you confirm the invoice payment on the frontend the payment will happen automatically
you wouldn't wait for 1h
What would I call for that to happen on the front end?
Here is my front end when I receive the clientsecret: I retrieve the setupintet & check the status:
if (clientSecret.startsWith("seti")) {
stripeLib
.retrieveSetupIntent(clientSecret)
.then(({ setupIntent }) => {
status.value = setupIntent.status;
switch (setupIntent.status) {
case "succeeded":
confirmationMessage.value =
"Payment scheduled! We have saved your payment details & you will receive a confirmation email when each payment is taken. Please check your Junk Mail folder as it may be in there.";
loading.value = false;
break;
case "processing":
confirmationMessage.value =
"Processing payment details. We'll update you when processing is complete.";
loading.value = false;
break;
case "requires_payment_method":
status.value = "failed";
confirmationMessage.value =
"Failed to process payment details. Please try another payment method.";
loading.value = false;
break;
case "requires_confirmation":
status.value = "processing";
this.stripeLib
.confirmSetupIntent(clientSecret)
.then(() => {
location.reload();
});
loading.value = false;
break;
you're creating a SetupIntent before creating the subscription?
So on doing this id the status is succeeded then I just call the confirmPaymnet?
Yes we were using setup_intents before
you shouldn't
instead you need to integrate by creating the subscription and confirmPayment of the first invoice
you can either create the Subscription first https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements#create-subscription
or you can do it using the deferred flow
https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=subscription
but in both cases, once you confirm the Invoice on the frontend the invoice gets automatically paid
Previously we created the subscription then collected the payment & if we had a trual used the pending_setup_intent to initialise elements
that's the way to go
OK but subscription schedules seem to fit our scenarios better... do they behave in the same way
I'm not sure what I'm doing wrong?
actually you can start by creating a subscription
OK
and then once the first invoice is created
you can create a schedule from the subscription
Is that the best way to do it?
I think so, yes, that's the easiest way
No the subscription has been created at this stage, and we get the setup intent associated wth the subscription using the PendingSetupIntentId
Thanks @gleaming loom I'll have a look and see if I can follow the flow better using the created subscription
Can I ask one last question around schedules?
yes of course
If you want the phase to be ongoing (i.e. never ending until it's manually cancelled), is there a way to do that? or do all phases have to have either an enddate or iterations set?
what I could do is create the subscription with out the schedule if it's ongoing?
no you can actually set the subscription schedule's end_behavior https://docs.stripe.com/api/subscription_schedules/object#subscription_schedule_object-end_behavior to release
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and set the iteration to 1 for the last phase
yeah but I don't want the payments to stop coming out
the release behavior would make the underlying subscription unmanaged by this schedule
they won't
ah I see, so it's like detaching the schedule?
Thank you, you have been so helpful, I think I have it ...I'll go back to the way we were creating the subscription & then update the subscription to have a schedule if we need to define the number of iterations/end date. Thanks a million for all your help