#igor-lamas_docs
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/1329837466265325658
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
You can't have a payment intent with an amount of $0, so when there's a trial, we create a setupintent instead. You can use this pending_setup_intent's client secret to collect payment method: https://docs.stripe.com/api/subscriptions/object#subscription_object-pending_setup_intent
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
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
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']
});
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
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.
Are you using the deferred intent integration?
Where you load payment element prior to creating the subscription/intent?
oohh
mode: 'payment',
amount: 1099,
currency: 'usd',
appearance: {},
paymentMethodTypes: ['card'],
}}>
</Elements>```
should I use subscription here?
mode: 'subscription'
yes
Do you create subscription prior to loading the Element?
Or after customer enteres payment info?
before to loading
ok
why the value is required here
It isn't
in Elements options