#igor-lamas_docs

1 messages ¡ Page 1 of 1 (latest)

whole basinBOT
#

👋 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/1329837466265325658

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

kind gull
mossy wraith
#
      customer: customer.id,
      items: [{ price: priceId }],
      trial_period_days: 7,
      payment_behavior: 'default_incomplete',
      payment_settings: {save_default_payment_method: 'on_subscription'},
      expand: ['latest_invoice.payment_intent']
    });
    
    const setupIntent = await stripe.setupIntents.create({
      customer: customer.id,
      payment_method_types: ['card'],
    });

    const clientSecret = setupIntent.client_secret;```
#

should this work?

#

having the setupIntent before the subscription

kind gull
#

You shouldn't create a setupintent

#

Creating a subscription with a trial creates a setupintent

#

Use the pending_setup_intent param to retrieve the automatically created setupintent

mossy wraith
#
      customer: customer.id,
      items: [{ price: priceId }],
      trial_period_days: 7,
      payment_behavior: 'default_incomplete',
      payment_settings: {save_default_payment_method: 'on_subscription'},
      expand: ['pending_setup_intent']
    });
kind gull
#

Yes exactly

#

And use that client secret from the pending_setup_intent

mossy wraith
#

ok, I'll try. thank you very much

#

one more thing

#
        elements,
        clientSecret: data.clientSecret,
        confirmParams: {
          return_url: `${window.location.origin}/`,
          payment_method_data: {
            billing_details: {
              name,
              email,
              phone,
            },
          },
        },
      });```
#

I got a erro here, asking to user confirmSetup

kind gull
#

Yep

mossy wraith
#

then I change to contirmSetup, and got this

#

Payment details were collected through Stripe Elements in payment mode and cannot be confirmed with a Setup Intent.

kind gull
#

Are you using the deferred intent integration?

#

Where you load payment element prior to creating the subscription/intent?

mossy wraith
#

oohh

#
          mode: 'payment',
          amount: 1099,
          currency: 'usd',
          appearance: {},
          paymentMethodTypes: ['card'],
        }}>

        </Elements>```
#

should I use subscription here?

#

mode: 'subscription'

kind gull
#

yes

#

Do you create subscription prior to loading the Element?

#

Or after customer enteres payment info?

mossy wraith
#

before to loading

kind gull
#

Then you shouldn't be passing mode

#

at all

mossy wraith
#

ok

kind gull
#

You should only need to pass client secret

#

That's it

mossy wraith
#

why the value is required here

kind gull
#

It isn't

mossy wraith
#

in Elements options

kind gull
#

It isn't

#

Not if you create subscription first

#

Of the setupintent

#

Assuming you actually are creating subscription prior to page load