#aaparth-3dsecure

1 messages · Page 1 of 1 (latest)

covert grove
#

@humble plinth what API did you call to get that error? Do you have a request ID req_xxx for it?

humble plinth
#

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

covert grove
#

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

humble plinth
#

I don't want customers to go to any external links, wants to handle inside my mobile apps

covert grove
covert grove
humble plinth
#

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

covert grove
#

let invoice = await stripe.invoices.retrieve(invoice.id, {expand:["payment_intent"]})

#

then let client_secret = invoice.payment_intent.client_secret

humble plinth
#

@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

  1. card expired
  2. 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

covert grove
#

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.

humble plinth
#

any code or function for that please, would be much helpful

#

so you mean I grab the client_secret from the invoice response ?

covert grove
#

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)

humble plinth
#

got it mate