#bilalahmer
1 messages ยท Page 1 of 1 (latest)
Sorry , What do you mean by recreate SetupIntents?
When you say you're moving to SetupIntents, what are you trying to achieve?
I already had stripe integrated in my site but most of the apis are depreciated and also i want to use google & aple pay thats why I'm moving to setup & payment intent.
So in the existing code before we were using data = Stripe::Charge.create(amount: value, currency: 'cad', customer: @id, description: description).to_hash
to charge the client.
So yesterday you guys suggested that dont use charge api anymore so to move from charge api I'm using paymentIntent .
PaymentIntent is asking for payment method.
So I'm getting the payment method by this code
Stripe::PaymentMethod.retrieve(Biller.from(@id).customer.default_source)
That's right. Do you want to charge a saved Payment Method or collect a new one from the customer?
The status requires_payment_method means you can display the Payment Element to the customer and ask them to provide details.
But as I mentioned I will be moving to setupIntent and in setupIntent we are getting the payment method through Stripe::Checkout::Session.retrieve .
So my question is cant i use one API call to get the payment method ?
Regardless the user have saved his credit card into with old api or setupIntent api ?
The Payment Method must be associated with a Customer to be reusable. If you know your Customer ID, you can retrieve it and reuse it to instantly confirm a new PaymentIntent. But you don't need that for SetupIntents. SetupIntents are designed to collect new Payment Methods for future use: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
whats the differenece between these two ?
Stripe::PaymentMethod.retrieve(Biller.from(@id).customer.default_source)
and
Stripe::Checkout::Session.retrieve.
They both are for getting payment method ?
Got it.
One more question
data = Stripe::PaymentIntent.create({ amount: value, automatic_payment_methods: {enabled: true }, currency: 'cad', description: description, customer: @id, }, stripe_version: '2022-11-15' )
Stripe::PaymentIntent.confirm(data.id, {payment_method: pm['data'][0]['id'] , return_url: 'https://example.com'})
In this they ask for return_url but i read in the documention it is optional but they still ask for it if i remove it .
Could you please share the exact error message.
Surre
You must provide a
return_urlwhen confirming a PaymentIntent usingautomatic_payment_methods[enabled]set totrueandautomatic_payment_methods[allow_redirects]set toalways.
Yes, it's required then.
You can set automatic_payment_methods[allow_redirects] to if_required but then you might loose some payment method types.
Yeah got it, Thankyou ๐
Can we use setupIntent with stripe element ?
and later I can move it to PaymentElement .
Yes, you can use SetupIntents with Payment Element
Got it, Thanks alot ๐
Happy to help!