#majuuk_subscription-setupintent
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/1291780379086426315
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there ๐ can you share the ID of the request you made to create a Subscription using this approach? That should have a req_ prefix.
I'm wondering if the first Invoice is a zero-dollar Invoice.
req_I8WQQqoGQk0OTC
ur probably right, i am doing a usage based subscription
of `1$ an hour
Yup, the amount_due of that first Invoice is 0, so no Payment Intent is created because there is no payment to be processed.
Instead you can also expand pending_setup_intent (on the Subscription object), and use its client secret to collect payment method details.
https://docs.stripe.com/api/subscriptions/object#subscription_object-pending_setup_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so because of that, i get an error
"e) IntegrationError: Your code called confirmPayment() but you passed a client_secret associated with a SetupIntent. Did you mean to call confirmSetup() instead?"
on the frontend when paying
Yup, you need to call confirmSetup() instead when working with a Setup Intent, as the error suggests.
ty
Any time!
ok so i did the payment
now instead of a payment succeeded, with a setup intent
i get a setup_intent id
and setup_intent_client_secret returnUrl
but stripe.confirmSetupIntent is deprecated
what should i use instead
confirmSetup()
so i have a form that allows you to put cc info in
the use hits submit
and i have this code
// Handle form submission
async function submit() {
if (!stripe || !elements) {
console.error('Stripe or Elements not initialized.');
return;
}
console.log("returnUrl: " + returnUrl);
// Ask Stripe to confirm the payment
const { error } = await stripe.confirmSetup({
// Pass instance that was used to create the Payment Element
elements,
// Specify where to send the user when payment succeeds
confirmParams: {
return_url: returnUrl,
},
});
if (error) {
// Handle error
console.error(error);
}
}
i get a return url
what do i do with it
What do you mean by "I get a return url"? That's backwards, you provide the return_url. As indicated by the comment in the code you shared, that's where the customer is redirected after the confirmation is completed.
yea i provided http://localhost:5173/checkout-complete
and it gives me the setup_intent and the setup_intent_client_secret
i need a page that says, setup complete or something
so in the example where they use payment_intent
they just call retrievePaymentIntent
and check to see if it is good
i need an equivalent function to call
So if you want to mirror that but with Setup Intents, you'd use retrieveSetupIntent:
https://docs.stripe.com/js/setup_intents/retrieve_setup_intent