Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Stripe Use 3D secure in Xamarin.Forms

JMERISEJMERISE Member ✭✭
edited October 13 in Xamarin.Forms

Hello,

I have implemented Stripe on a Xamarin.Forms application my code works well, but when the payment requires a secure 3D authentication, I use the WebView to display the authentication page but the link is always null.

result.NextAction?.RedirectToUrl?.Url

switch (result.NextAction?.Type)
            {
                case null:
                    await Xamarin.Forms.Application.Current.MainPage.DisplayAlert("Success", "Your purchase was successful!", "OK");
                    break; 
                case "use_stripe_sdk":
                    var webView = new WebView
                    {
                        Source = new UrlWebViewSource { Url = result.NextAction?.RedirectToUrl?.Url }
                    };

                    webView.Navigating += (s, e) =>
                    {
                        if (e.Url.StartsWith("close://"))
                        {
                            e.Cancel = true;

                            Xamarin.Forms.Application.Current.MainPage.Navigation.PopModalAsync();
                        }
                    };

                    await Xamarin.Forms.Application.Current.MainPage.Navigation.PushModalAsync(new NavigationPage(new ContentPage
                    {
                        Title = "3D Secure",
                        Content = webView
                    }));
                    break;
                default:
                    throw new NotImplementedException($"Not implemented: Can't handle {result.NextAction.Type}");
            }
Sign In or Register to comment.