stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

Question: 3D Secure flow auto dismiss browser

Open vigzmv opened this issue 5 years ago • 3 comments

Describe the bug After 3DS Authenticating in webview, the page stays at "Authentication Complete". In the docs here, at the bottom, it mentions something about a return_url.

3D Secure authentication must be completed for the payment to be successful. Triggers the challenge flow using a webview. You can check that your return_url dismisses the modal.

I suppose there is a way to pass an App scheme URL to automatically close the browser and go back to app. But I couldn't find any reference to return_url in this codebase, so I don't know how to use it

Please help if auto close is possible now and if not, can a feature request be added? Thanks

vigzmv avatar May 07 '21 19:05 vigzmv

The return_url is automatically set based on the urlScheme that you pass to the StripeProvider: https://stripe.dev/stripe-react-native/api-reference/interfaces/stripeproviderprops.html#urlscheme

But you're right that this isn't clear from the docs. Thanks for the feedback!

In https://stripe.com/docs/payments/3d-secure#when-to-use-3d-secure under the React Native tab, we will need to add:

"To automatically dismiss the webview when authentication is finished, configure a custom URL scheme or universal link and set your scheme in the urlScheme parameter."

And update the code snippet to

function PaymentScreen() {
  return (
    <StripeProvider
      publishableKey="{% key /%}"
      urlScheme="your-url-scheme"
      threeDSecureParams={{
        backgroundColor: '#FFFFFF', // iOS only
        timeout: 5,
        label: {
          headingTextColor: '#000000',
          headingFontSize: 13,
        },
        navigationBar: {
          headerText: '3d secure',
        },
        footer: {
          backgroundColor: '#FFFFFF', // iOS only
        },
        submitButton: {
          backgroundColor: '#000000',
          borderRadius: 12,
          textColor: '#FFFFFF',
          textFontSize: 14,
        },
      }}
    >
      // ....
    </StripeProvider>
  );
}

thorsten-stripe avatar May 10 '21 03:05 thorsten-stripe

Adding @laurenoh-stripe to this issue ✅

trag-stripe avatar May 19 '21 21:05 trag-stripe

This is all set! https://stripe.com/docs/payments/3d-secure#when-to-use-3d-secure

laurenoh-stripe avatar May 20 '21 14:05 laurenoh-stripe