#rzhang139 - Setup Intent
1 messages · Page 1 of 1 (latest)
hello
Setup Intents and Payment Intents are two different things with different uses.
What are you trying to do here?
i am trying to first create a setupIntent and save a users information, then once another event is fired, I want to make that setupIntent as an executed transaction
Setup Intents are used to collect payment details for future payments but they are not used to execute transactions.
how do I convert it into a transaction being executed?
Yeah, that's a different intent altogether
Ok, how do I convert it into paymentIntent
You don't "convert" into a payment intent.
The setup intent allows you to save a payment method for later use
So after you use it you have a customer which an attached payment method
You can use that attached payment method in later transactions
ok how can i use that attached payment method for later transactions?
WE have this documented here: https://stripe.com/docs/payments/save-and-reuse
Both the saving of the payment method and the charging it later (scroll down)
ok cool, so does this code allow us to charge the user without their authorization (no checkout session needed):
const paymentIntent = await stripe.paymentIntents.create({
amount: 1099,
currency: 'usd',
customer: '{{CUSTOMER_ID}}',
payment_method: '{{PAYMENT_METHOD_ID}}',
off_session: true,
confirm: true,
});
and after this call, does it fire payment_intent.succeeded
Yup. And as long as the PI is successful it will fire that webhook event
Great! I am concerned about the reliability of webhooks, should I add code that checks if the PI succeeded as a fallback? Or are webhooks 100% guaranteed
Webhooks are as reliable as our APIs. Especially since, if delivery fails, they will retry themselves a number of times until your server responds with a 200 status
If you are curious, concerned, or just want to be sure of your understanding, I would recommending reading this doc (links included)
https://stripe.com/docs/webhooks
great! thank you so much! that is all for me