#_aghor
1 messages · Page 1 of 1 (latest)
hello! how did you get to the 3DS authentication page? Can you share your code snippet?
Hi @modest isle Have you implemented the deeplinking listener? Details in : https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-set-up-return-url
import React, { useEffect, useCallback } from 'react';
import { Linking } from 'react-native';
import { useStripe } from '@stripe/stripe-react-native';
import { RootApp } from './RootApp';
export default function MyApp() {
const { handleURLCallback } = useStripe();
const handleDeepLink = useCallback(
async (url: string | null) => {
if (url) {
const stripeHandled = await handleURLCallback(url);
console.log('Stripe handled deeplink: ', stripeHandled);
if (stripeHandled) {
// This was a Stripe URL - you can return or add extra handling here as you see fit
} else {
// This was NOT a Stripe URL – handle as you normally would
}
}
},
[handleURLCallback]
);
useEffect(() => {
const getUrlAsync = async () => {
const initialUrl = await Linking.getInitialURL();
handleDeepLink(initialUrl);
};
getUrlAsync();
const deepLinkListener = Linking.addEventListener(
'url',
(event: { url: string }) => {
handleDeepLink(event.url);
}
);
return () => deepLinkListener.remove();
}, [handleDeepLink]);
return (
<RootApp />
);
}
this one right ?
Are there any additional steps for closing the the stripe in build webview ?
Have also defined a custom URL in your iOS app? https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app
https://stripe.com/docs/payments/accept-a-payment?platform=ios&ui=payment-sheet#ios-set-up-return-url this is how you handle in iOS native. Can you check your iOS part and see if the AppDelegate has also implemented func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { ?
need to handle this on .mm file ?
In general you don't. But I'd suggest you to check your AppDelegate and see if the function is overriden which could prevent the react-native Linking from working.