#shiva - react native

1 messages ยท Page 1 of 1 (latest)

desert canyon
#

Hello! Just starting a thread for you -- I'll review and respond as soon as I can ๐Ÿ™‚

acoustic canopy
#

thank you

desert canyon
#

Which payment method are you using here, and is this in test mode or live?

acoustic canopy
#

payment method: [ideal,card]

#

i have tried it in both, live and test mode

desert canyon
#

I believe in live mode its possible that some banks might not automatically redirect and some action is needed, but in test mode i expect that your authentication pages should redirect automatically

acoustic canopy
#

can i share you the video for test mode ?

desert canyon
#

Sure, but please be sure to obscure any secrets or private info

acoustic canopy
#

Sure i will share the behavior

desert canyon
acoustic canopy
#

in which file do we suppose to add the deep linking ?

#

app.js ? the root file?

desert canyon
#

The example appears to be near the root, but anywhere to handle the event appropriate, its your choice

#

Note the link to the react native docs which also requires some configuration

acoustic canopy
#

I see this function:

const handleDeepLink = async () => {
if (url && url.includes(safepay)) {
await handleURLCallback(url);
navigation.navigate('PaymentResultScreen', { url });
}
};

#

which url is being refffered here ?

#

there is no variable of url here

desert canyon
#

its the parameter of the async function in the callback

#

your snippet is not what in the docs

#
const handleDeepLink = useCallback(
    async (url: string | null) => { // <<<<<<< url is the param here
      if (url && url.includes('safepay')) {
        await handleURLCallback(url);
        // Add extra handling here as you see fit
      }
    },
    [handleURLCallback]
  );
acoustic canopy
#

i copied from the doc

desert canyon
#

Sorry i sent a second link for the payment element scenario

acoustic canopy
#

well im using expo which is for cross platform

#

wont it work on andorid then ?

desert canyon
#

It's not needed on android, that platform allows us to handle the necessary piece automatically

#

this extra setup step is iOS only

#

(your video showed iOS which is part of what guided me to this)

acoustic canopy
#

ok

#

but

#

const handleDeepLink = useCallback(
async (url: string | null) => {
if (url && url.includes('safepay')) {
await handleURLCallback(url);
// Add extra handling here as you see fit
}
},
[handleURLCallback]
);

#

what is useCallback now ?

#

i dont thiink this documentation is correct/complete

desert canyon
#

useCallback is from React, it's not specific to Stripe. eg, a sibling to useState and useEffect etc

acoustic canopy
#

got it

#

testing out

desert canyon
acoustic canopy
#

I see ther eis an if condition that check for safe_pay but my url does not have that

#

exp://172.16.0.10:19000/--/home?payment_intent=&payment_intent_client_secret=*&redirect_status=succeeded

#

this is what i get when i print url

desert canyon
#

No, you'd change that to be based on your own URL, if i recall

#

i believe "safepay" is merely an example

acoustic canopy
#

ok so i can use succeeded ?

#

oh it worked, my god, you are an absolute legend

desert canyon
#

๐Ÿ™Œ

acoustic canopy
#

is
if (url && url.includes('succeeded')) {
a good practice ?

desert canyon
#

You'd want it to be specific to your custom redirect url

acoustic canopy
#

oh i see

#

that makes sense

desert canyon
#

ie you might use in prod: mycoolapp://paymentsuccess/path/here and match on paymentsuccess, etc

acoustic canopy
#

i see

#

perfect

#

thank you very much for the quick support

lime relic
#

Hey Shiva. ๐Ÿ™‚