#rmoura_js-pi&si

1 messages · Page 1 of 1 (latest)

terse sleet
#

Nope. you'd need to create the setup intent instead, you can convert them. You can use a payment intent to save the details for future though, during a payment, if that's what you want.

#

But to collect details without a payment, you need to create a setup intent

atomic gulch
#

hmm

#

ok

#

any wayy to skip the payment error minimum amount

#

?

terse sleet
#

No, there is a minimum charge amount. WHat are you trying to do?

atomic gulch
#

Is there a faster way to do this

#
          retrieved_intent = Stripe::SetupIntent.retrieve(intent_id)
          payment_method = Stripe::PaymentMethod.retrieve(retrieved_intent.payment_method)

#

in one request i mean

hoary shoal
#

yes

#

so depends, where are you making those retrieve calls? in a webhook endpoint? some other way?

atomic gulch
#

not on a webhook

hoary shoal
#

not on a webhook
where then? a client-side request to your server?

#

asking for more detail so I can give you the right answer

atomic gulch
#

server side

#

client-side request

#

yeag

hoary shoal
#

gotcha, and what are you making that request based on? like confirmCardSetup() completing on your webpage, right?

atomic gulch
#

confirmSetup

hoary shoal
#

gotcha, so at that point you have both a SetupIntent ID and a PaymentMethod ID
You can retrieve the SetupIntent ID server-side (like you are doing) but pass expand: ['payment_method'] to also fetch the PM as well in one request
https://stripe.com/docs/api/expanding_objects

atomic gulch
#

wow

#

very nice

atomic gulch
#

how to add billing adress information on a Stripe::PaymentIntent.create({

hoary shoal
#

you don't add it there

#

you add it on the PaymentMethod, so in Elements

atomic gulch
#

hmmm

#

ok

#

can you share any tutorial for oding this

hoary shoal
#

this shows you how you pass billing details

atomic gulch
#

thank you

#

How to disable elements inputs?

#

but when i do this elements.update({disabled: true}); nothing happends

deep sage
#

Hello! To clarify, is elements a specific Stripe Element?

atomic gulch
#

I think I did it

#

but I have another question

#

I have this and if the user choose "Every 2 years" its free we just save the card (setupintent) but if its 3 years the user have to pay (payment intent). What do you suggest I do?

#

Start the payment element with 0 $ gives me an error ... so what am i supposed to do?

deep sage
#

You would need to conditionally create a Setup Intent or a Payment Intent, and once the choice is made and you have the Intent then create and display the Payment Element.

atomic gulch
#

but the user can change .... its choice after the payment element is presented

deep sage
#

You would need to remove the Payment Element and create it again if it's all on the same page. I recommend you have them make a selection and then present the Payment Element on another page after that though.

atomic gulch
#

hmm ok