#aaparth-3dsecure
1 messages · Page 1 of 1 (latest)
@humble plinth what API did you call to get that error? Do you have a request ID req_xxx for it?
yeah I have got the request Id
const invoice = await stripe.invoices.pay(
data.invoice_id, {
payment_method: data.payment_method_id
});
used this code
req_rYSVPDTIsSgcO1
this is the request id
cool cool
yep, you should not call that invoices.pay endpoint, it doesn't support 3D Secure
instead , you should either :
a) take the invoice.hosted_invoice_url and redirect the customer to that, and they can pay there
I don't want customers to go to any external links, wants to handle inside my mobile apps
b) build a payment page , redirect the customer to that, and then call https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-attached to complete the payment there , using invoice.payment_intent.client_secret
cool, then it's a variation on b), you'd use a Stripe function to confirm the PaymentIntent from the Invoice (exact details depends what you mean by 'app' and if you're using our mobile SDKs in it)
yeah I got that point that I need a client_secret to handle next action on the mobile sdk but not sure how can I get the client_secret
let invoice = await stripe.invoices.retrieve(invoice.id, {expand:["payment_intent"]})
then let client_secret = invoice.payment_intent.client_secret
@covert grove
over here I have 1 more question
customer had card A as a default payment and for some reason the payment has failed for some reason
- card expired
- insufficient funds
or something else whatever the reason is
Now I want the customer to add a new card to pay for the subscription.
I know I can just add the card to customer's object but not sure after doing that how can I make him pay for the Invoice using the same method_id
The solution you gave me works best when we get the authentication_required in the webhook and that seems to work really well
after doing that how can I make him pay for the Invoice using the same method_id
you grab the PaymentIntent of their latest invoice and then confirm it with the new PaymentMethod.
any code or function for that please, would be much helpful
so you mean I grab the client_secret from the invoice response ?
I shared above how you get the client_secret from an invoice. After that, it depends on how your frontend works(is it a web page using stripe.js , is it a mobile app, if so is it iOS or Android, etc)
got it mate