#TootLips
1 messages · Page 1 of 1 (latest)
Interesting, are you trying to manually trigger the 3DS flow?
Is there a guide you're following for this?
We get this error when using a 3ds2 test card from https://stripe.com/docs/testing 4000 0000 0000 3220
our backend gives us a client secret that the app feeds into the following function https://stripe.dev/stripe-ios/stripepayments/documentation/stripepayments/stppaymenthandler/handlenextaction(forpayment:with:returnurl:completion:)
the first attempt at using the client secret works correctly and the 3ds webview is shown.
However, if a user terminates the mobile app while viewing the 3ds auth web view, the app will attempt to use the same same clientSecret to show the 3ds promp again. Using the same clientSecret a second time, gives us the error stating that JSON payload could not be parsed
Stepping in and catching up
Can you share the code that calls handleNextAction ?
self.stripePaymentHandler.handleNextAction(forPayment: secret, with: context, returnURL: nil)
secret is the clientSecret and context is an objcet that adheres to STPAuthenticationContext
Gotcha. We don't typically see folks using the function directly as PaymentSheet & flowcontroller flow supports 3DS natively.
Is this something that used to work before but broke recently?
no, this has been broken for some time now, but addressing payment errors has become a priority recently for us
Can you try calling the confirmPayment method instead of using handleNextAction directly?
~~https://stripe.dev/stripe-ios/stripe-payments/Classes/STPPaymentHandler.html#/c:@M@StripePayments@objc(cs)STPPaymentHandler(im)confirmPayment:withAuthenticationContext:completion:~~
Ah that link seems to be broken
We have an example here if that helps
https://stripe.com/docs/payments/accept-a-payment?platform=ios&ui=custom#ios-submit-payment
same error with the new function
Interesting..
so, when using a brand new clientSecret https://api.stripe.com/v1/3ds2/authenticate returns
"id": "threeds2_1Mz4ejJjI7oqAmtifF9rzbAP",
"object": "three_d_secure_2",
"ares": null,
"created": 1682024681,
"creq": null,
"error": null,
"fallback_redirect_url": "https://hooks.stripe.com/3d_secure_2/hosted/payatt_3Mz4eeJjI7oqAmti1OkSMOnV?merchant=acct_1FbucmJjI7oqAmti&payment_intent=pi_3Mz4eeJjI7oqAmti1iMsqYUe&payment_intent_client_secret=pi_3Mz4eeJjI7oqAmti1iMsqYUe_secret_Vg8eDlZ3kzoe2YxuLHHlTB7aI&publishable_key=pk_test_2Zxs26AlTZezW9XlnyvmAsAY00NpoSuGI9&source=payatt_3Mz4eeJjI7oqAmti1OkSMOnV",
"livemode": false,
"source": "payatt_3Mz4eeJjI7oqAmti1OkSMOnV",
"state": null
}```
This json is valid, and the 3ds prompt is shown
How exactly are you attempting to use the same clientSecret?
Are you retrieving it again OR have you stored it locally?
We get the clientSecret from our backend which has webhooks to wait for a response for 3ds.
yeah, quitting the app fails the 3DS challenge so a new challenge is required.
I wonder if your app is trying to use the old challenge instead.
Could you try retrieving the PaymentIntent again before you re-attempt?
https://stripe.dev/stripe-ios/stripepayments/documentation/stripepayments/stpapiclient/retrievepaymentintent(withclientsecret:completion:)
ok, give me a second
retrievePaymentIntent(withClientSecret returns the same clientSecret
Right but I am curious to see if it presents a new challenge instead
If that doesn't work, a quick fix would be to cancel the previous PaymentIntent and create a new one when your user relaunches the app
i get same error after getting the payment intent again
Ah that's a bummer
is this potentially a stripe iOS SDK bug? not being able to parse json seems like an unexpected scenario
Could be. We'll need to reproduce this behavior on our end to make sure we havent' missed anything.
Would you mind writing into our support team via
https://support.stripe.com/?contact=true
Providing as much details as you can about your integration such as SDK version, sample code etc.
If you can share a minimal sample app that can help us reproduce this on our end, that'd be awesome too.
Make sure to mention you spoke with Hanzo on discord
Let us know once you write in so that our team can pull the ticket
In the meantime, following should definitely work as an alternative
If that doesn't work, a quick fix would be to cancel the previous PaymentIntent and create a new one when your user relaunches the app
ok, thanks for the help