checkout / frames-ios

Frames iOS: making native card payments simple

Home Page:https://www.checkout.com/docs/integrate/sdks/ios-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't obtain 3D Secure success/failure url

Oleygen opened this issue · comments

In short: we have a web and mobile application, both using Checkout Hub with data, 3DS works fine for web.
I'm trying to use ThreedsWebViewController to implement 3D Secure feature on iOS, but its webView redirects to random url.

  1. Create token with

CheckoutAPIClient(publicKey: publicKey, environment: .sandbox)

  1. Send token to back-end, back-end responds with url
  2. Create and show

ThreedsWebViewController(successUrl: "HTTPS://ourapp.com/PaymentSuccess", failUrl: "HTTPS://ourapp.com/PaymentFailure")

  1. Enter code into opened webView window and tap "Continue"
  2. Looking for redirect url in

func webView(_ webView: WKWebView,
didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!)
print(webView.url!)

Expected value: HTTPS://ourapp.com/PaymentSuccess
Actual value: https://3ds2-sandbox.ckotech.co/interceptor/3ds_dl5v2ubsgv4udi2m53i6ze6ki4/device-information

Hi @Oleygen

You need to define they dynamic success_url and failure_url when sending the payment request in step 2 as well as defined here.

These should be the same values you then set when initialising ThreedsWebViewController in the mobile app.

The redirection to success_url or failure_url happens after the first redirection to https://3ds2-sandbox.ckotech.co/interceptor/3ds_xxxxxx... depending on whether the cardholder succeeds or fails the 3DS authentication in the interceptor.

@nicolas-maalouf-cko
from docs:

success_url For redirect payment methods, this overrides the default success redirect URL configured on your account

We're set those urls on a Checkout Hub, or still should we to sent those params?

If you don't send them in the payment request then the default values on the hub will be used

Right. Therefore default values set, but still incorrect url comes from a webView

The interceptor URL is the one that needs to first be loaded in the webview, and then when the cardholder interacts with the UI they're redirected to the success or failure URL.

When you say "Actual value" for the URL, where are you actually reading it from?

@nicolas-maalouf-cko
ThreedsWebViewController.webview.url
or

    func webView(_ webView: WKWebView,
    didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!) {
    print(webView.url!)

@Oleygen this could be happening because of how our 3DS interceptor was updated for 3DS2

Would you be able to try to comment out this line:
https://github.com/checkout/frames-ios/blob/master/Source/ThreedsWebViewController.swift#L74

And try again see if the problem is resolved?

Thanks

@nicolas-maalouf-cko
Commenting out that line helped. Thanks!