Adyen / adyen-ios

Adyen iOS Drop-in and Components
https://docs.adyen.com/checkout/ios
MIT License
151 stars 120 forks source link

[NEED ASSIST] RedirectComponent doesn't open 3DS redirect url #1621

Closed radetara closed 6 months ago

radetara commented 6 months ago

Describe the challenge I am trying to test credit card 3DS components implementation for advanced flow.

I am just calling redirectComponent.handle(action) without setting presentationDelegate for RedirectComponent first, so I expect it to open the browser.

It seems to be trying to open given action url as universal link in AppLauncher within openUniversalAppUrl method, but fails (nothing happens). We already have Associated Domains enabled in Xcode, so I added different domain versions of the redirect url (https://checkoutshopper-test.adyen.com/checkoutshopper/threeDS/redirect...) as applinks:<domain> there, but I assume web app counterpart is missing (or maybe something else).

Could you pls advise how to proceed and enable further testing of 3DS redirect in my case. Thanks!

Btw, if I remove universal links only flag in AppLauncher just as a tryout, browser is opened and entire flow works as expected.

atmamont commented 6 months ago

Hi @radetara,

Could you share with us a code sample of your integration?

We recommend calling AdyenActionComponent.handle instead of calling RedirectComponent.handle directly as the AdyenActionComponent decodes the action and forwards it to the correct component.

Also you can take a look at our integration example.

radetara commented 6 months ago

Hi @atmamont

Thanks for your reply! I do call now AdyenActionComponent.handle instead of calling RedirectComponent.handle directly as per your recommendation, but this will not address my issue.

In the given integration example you provide presentation delegate to action component:

let handler = AdyenActionComponent(context: context)
...
handler.presentationDelegate = self

Which leads eventually to retrieving the component in present(component: Adyen.PresentableComponent) and being able to present it's viewController in app.

What I am trying to achieve is to open the browser (Safari) instead.

So I am not assigning presentation delegate to action component but rather relying on it to handle the action by opening the browser itself. Which it indeed tries to do in above mentioned AppLauncher method, once the presentation delegate is not found. But it tries to open the given redirect url from action as the universal link.

That's the step I am having issue with, cause I don't know how to set up action redirect link to be opened properly by app when

UIApplication.shared.open(url,
                                  options: [UIApplication.OpenExternalURLOptionsKey.universalLinksOnly: true],
                                  completionHandler: completion)

is called, because of the .universalLinksOnly flag set to true.

Could you please advise and/or provide me with documentation or example that doesn't set presentation delegate for AdyenActionComponent?

Thank you!

nauaros commented 6 months ago

Good morning @radetara !

Unfortunately, we don't support this kind of flow in the current version of the SDK. The opening of redirect URLs will be handled by the RedirectComponent by opening a SFSafariViewController in app (via presentationDelegate). There's still the option within the SFSafariViewController to open in Safari (button on the bottom-right corner).

With this said, we don't recommend opening redirects directly on Safari as it may disrupt the flow. If this is a hard requirement for you, you can always capture the redirect-url from the Action object you receive and build your own logic to open directly on Safari.

radetara commented 6 months ago

Hello @nauaros!

Thank you for answering! It cleared things up and narrowed down my options!

Now I know how to proceed,

Thanks again!