#majuuk_subscription-setupintent

1 messages ยท Page 1 of 1 (latest)

tawny mortarBOT
#

๐Ÿ‘‹ 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.

slate roostBOT
mossy trellis
#

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.

wooden beacon
#

req_I8WQQqoGQk0OTC

#

ur probably right, i am doing a usage based subscription

#

of `1$ an hour

mossy trellis
#

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

wooden beacon
#

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

mossy trellis
#

Yup, you need to call confirmSetup() instead when working with a Setup Intent, as the error suggests.

wooden beacon
#

ty

mossy trellis
#

Any time!

wooden beacon
#

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

mossy trellis
#

confirmSetup()

wooden beacon
#

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

mossy trellis
#

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.

wooden beacon
#

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

mossy trellis
tawny mortarBOT
wooden beacon
#

cool ty

#

jsut checking