#akii-payment-confirmation
1 messages ยท Page 1 of 1 (latest)
Im making a Payment intent, and trying to charge user an amount , that should also pay using its default source. I also wanted to do that using frontend, so that if the card requires authentication then Striep can handle that.
Can u help?
Yup, I'm looking for the relevant docs
Okay thanks.
Im also looking for one more thing...
Is there any paramter in Payment Intent that i can set, so it saves the card that i enter??
Like payment_settings-save_default_payment_method
When the payment intent is created with payment method, it'll return status requires_action if further authentication is required. You can then use stripe.handleNextAction(client_secret) to perform 3DS: https://stripe.com/docs/payments/finalize-payments-on-the-server#next-actions
Okay
You can save the card to the customer with the doc here: https://stripe.com/docs/payments/save-during-payment
If you wish to set the payment method created as default, then additional update customer call is required: https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Okay
I dont get this one... Im actually using Payment intent that is made when creating an invoice...
Do you have a sample payment intent generated by invoice that requires 3DS?
okay wait checking..
Im not able to find this method on ui stripe.handleNextAction(client_secret)
Ah, it looks like stripe.handleNextAction(..) is in beta
I'll hand over this thread to my colleague @edgy garden to check if there's any better way to:
- use default payment method for an invoice
- handle extra action if required
Hello, jumping in for river ๐
@dry dome If I understand correctly, you created an Invoice server-side and got the PaymentIntent inside it, correct?
And I suppose you have the PaymentMethod Id already attached to it?
Anw it would be easier if you can share a sample Payment Intent Id (pi_xxx) and I can take a closer look
I am checking on it
So I see you created an Invoice from a Customer that already has a PaymentMethod attached, so it's delegated to this PaymentIntent
yes
pm_1LKxb8GLOO5b7AOMNHJ1kPyl
yes
So what you want to do is go ahead and confirm this PaymentIntent serverside. Then if it returns with requires_action status, pass it back to client-side and use handleCardAction which is outlined here https://stripe.com/docs/payments/accept-a-payment-synchronously?platform=web#web-handle-next-actions
okay
That way handleCardAction will take care of 3DS
okay thanks
looks like this will work
I had one more doubt.
Im using stripe in a REACT Js application.
I am having trouble with having to load <Elements> tag with clientSecret.
I want to use useStripe hook everywhere in my app, without having to deal with clientSecret.
Yes, but i have done this and its working, now when the stripe is redirecting me to return_url, i again want to use a stripe call, which means i again need to have <Elements> tag loaded???
Can you elaborate a bit more? What do you mean by again want to use a stripe call
See, lets say I have a component where i want to call stripe.handleCardAction(). Now here i will be passing the clientSecret tht i got from backend API . It gives me an error that you need to wrap this inside an <Elements > container.
But now again even if i wrap it in a <elements> container, then i will need clientSecret as well.
Where will i provide this cs from?
Sorry if I am missing something but how about just initialize stripe.js to call handleCardAction?
var stripe = Stripe('pk_test_xxx');
stripe.handleCardAction('pi_secret')
TypeError: (0 , stripe_stripe_js__WEBPACK_IMPORTED_MODULE_16_.Stripe) is not a function
This is error its giving, when using Stripe('pk_test_xxx');
Now when you have this stripe.js instance, you can try calling handleCardAction
okay trying this,please dont close the thread