#jry_j-alipay-reactnative
1 messages ยท Page 1 of 1 (latest)
@scarlet hull hello! Flagging I know ~nothing about React Native but my team does so I can work with you and try to clarify and get you unblocked
So you mention a webview overlay, can you share a screenshot of what you see first and also share the relevant code and what is blocking you?
of course
Here's a video of the issue, pressing return to merchant doesn't do anything, and you'll have to press Close to return to the app and get a success response
Here's the implementation in my App.js, translated from the functional example that you guys had in the documentation
Can you share real code instead of pictures of code?
oh sorry
async componentDidMount() { const initialUrl = await Linking.getInitialURL(); this.handleDeepLink(initialUrl); Linking.addEventListener('url', (event) => { console.warn('EVENT'); this.handleDeepLink(event.url); }); }
handleDeepLink = async (url) => { console.warn('url', url); if (url && url.includes('safepay')) { await handleURLCallback(url); console.warn('SAFEPAY'); } }; componentWillUnmount() { Linking.removeEventListener('url', (event) => { console.warn('EVENT'); this.handleDeepLink(event.url); }); }
hey there
Hi
are there any errors surfaced related to this? can you share an example payment intent ID you're creating with a redirect back to your app?
Sure
I haven't seen any errors
pi_3Ja3WTIRk2Tp6gkD17hv6u9C
do you need the full object or just the id?
const paymentIntent = await stripe.paymentIntents.create({ payment_method_types: ['alipay', 'card'], amount: 1099, currency: 'cad', customer: stripe_cuid, }); I'm currently using the example from doc to create the Payment Intents
do you guys need more info?
No worries, I've been self teaching the whole development so it may just be I'm too dumb haha ๐
@scarlet hull in you initial message you mentioned urlScheme but i dont see that mentioned anywhere else -- how are you using this currently to redirect?
that's in my App.js in the StripeProvider container
<StripeProvider // Stripe Migration publishableKey={STRIPE_PUBLISHABLE_KEY} urlScheme={'myapp'} merchantIdentifier='PLACEHOLDER' // for Apple Pay > <View style={styles.container}> {Platform.OS === 'ios' && <StatusBar barStyle='default' />} <Provider store={store}> <AppNavigator /> </Provider> </View> </StripeProvider>
I replaced my actual urlScheme with 'myapp' and replaced my merchant identifier as well just for privacy sake
In the payment intent object I see on the Alipay webscreen, it will have a return_url parameter that takes my urlScheme and add ://safepay at the end, so in this case it'll be myapp://safepay
there is other configuration needed to register you app to handle the scheme overall, though, for example with react navigation:
https://reactnavigation.org/docs/deep-linking/#set-up-with-bare-react-native-projects
you need to set up some underlying infra to have your app get those requests
awesome!
thanks so much, I wouldn't have ever guessed that to be the case
looks like I was missing those setups with linking
glad to hear thats working for you, thanks for you patience here ๐