#rzhang139 - Setup Intent

1 messages · Page 1 of 1 (latest)

heavy flume
#

Hi 👋

ionic crag
#

hello

heavy flume
#

Setup Intents and Payment Intents are two different things with different uses.

#

What are you trying to do here?

ionic crag
#

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

heavy flume
#

Setup Intents are used to collect payment details for future payments but they are not used to execute transactions.

ionic crag
#

how do I convert it into a transaction being executed?

heavy flume
#

Yeah, that's a different intent altogether

ionic crag
#

Ok, how do I convert it into paymentIntent

heavy flume
#

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

ionic crag
#

ok how can i use that attached payment method for later transactions?

heavy flume
#

Both the saving of the payment method and the charging it later (scroll down)

ionic crag
#

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

heavy flume
#

Yup. And as long as the PI is successful it will fire that webhook event

ionic crag
#

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

heavy flume
#

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

ionic crag
#

great! thank you so much! that is all for me