#kamran-reactnative

1 messages · Page 1 of 1 (latest)

cold crystal
radiant tendon
#

i am integrating stripe with react native backend JAVA
I want to create connect custom account react native side..
so for that we have to create a token

cold crystal
#

yes I know

#

I read your messages!

#

I haven't seen this error before. Can you share the full stack trace for it?

radiant tendon
#

Possible Unhandled Promise Rejection (id: 0):
TypeError: Cannot read properties of undefined (reading 'initialise')
TypeError: Cannot read properties of undefined (reading 'initialise')
at initStripe$ (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.weeclik&modulesOnly=false&runModule=true:116440:38)
at tryCatch (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.weeclik&modulesOnly=false&runModule=true:7703:19)
at Generator.invoke [as _invoke] (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.weeclik&modulesOnly=false&runModule=true:7876:24)
at Generator.next (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.weeclik&modulesOnly=false&runModule=true:7746:23)
at tryCatch (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.weeclik&modulesOnly=false&runModule=true:7703:19)
at invoke (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.weeclik&modulesOnly=false&runModule=true:7776:22)
at http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.weeclik&modulesOnly=false&runModule=true:7806:13
at tryCallTwo (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.weeclik&modulesOnly=false&runModule=true:28586:7)
at doResolve (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.weeclik&modulesOnly=false&runModule=true:28750:15)
at new Promise (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.weeclik&modulesOnly=false&runModule=true:28609:5)

#

_NativeStripeSdk.default.initialise(extendedParams);

#

error at this point

cold crystal
#

(the fi being to upgrade your version of Expo Go)

radiant tendon
#

react-native-cli: 2.0.1
react-native: 0.64.2

#

okay thanks solved now..

cold crystal
#

what was the solution?

#

just so I can take a note in case someone else sees this

radiant tendon
#

the solutions is there are two way to install the dependencies...

#

expo install @stripe/stripe-react-native

#

npm install @stripe/stripe-react-native

#

1st one is correct..

#

understood?

#

i am getting more erros... can we discuss here or i create a new thread

#

i want to create a token for connect custom account.. so what i do.

#

createToken is not working..

#

"Account type is not supported yet"

#

const v = await createToken({type : 'Account', name :'abcd'});
console.log('stripe.createToken --->',v);

cold crystal
#

yep you can't do this yet in our React Native library unfortunately

radiant tendon
#

so help me out.. how can i create custom account..

#

because in France we have to initialise token first.

cold crystal
#

easiest way would be to build a website for this instead and then open that in the browser instead of doing it natively

#

yep in France you have to use account tokens

radiant tendon
#

i am not working on website..

#

reactive mobiel apps

cold crystal
#

yes but you'll have to workaround this limitation I'm afraid!

#

if you're comfortable with it you could write some custom code to call the /v1/tokens API directly from some HTTP code in your app instead of using the library but it would be complicated

radiant tendon
#

how can i do.. can you guide me how can i directly call /v1/token

#

any documentation

cold crystal
#

you'd need to write some code to call that API directly

radiant tendon
#

so i have to this on server side..

#

let me try my side..

cold crystal
#

no you do it in the app, not the server side.

#

that API can be called with a publishable key so you can write code in the app to call it

radiant tendon
#

hmm...

#

but app is react native...

cold crystal
#

yes?

#

you can't use our SDK

#

but you can write code to just make a HTTP call directly

#

like I said, it would be complicated!

radiant tendon
#

yes i understand..

#

but for http call
i need request parameters and complete url..

#

so an you guide me that..

cold crystal
#

I can't really share more than I already did

radiant tendon
#

okay thank you..

#

one thing plz

#

on serverside..
i first create token and then create account..

#

it is working...

#

so is it right approach..?

cold crystal
#

technically it's supposed to be client-side if you're in France

#

we don't enforce it in test mode to make testing easier but it won't work in production(creating AccountTokens on the backend server with a secret key)

radiant tendon
#

hmm..

cold crystal
#

really sorry, I know it's not a great situation!

radiant tendon
#

okay. tell me if i generate token on client side. and in future i want to update client information. what would be the procedure..

cold crystal
#

just to point out, all this is only relevant if you're using Custom Connect accounts

#

are you sure you have to? Most platforms should use Express unless you really want to whitelabel the whole onboarding yourself ,it's a major development effort to build a Custom Connect platform.

radiant tendon
#

ya we want to use custom account.. we create our own stripe account manage bank account and do payouts..

radiant tendon
#

tell if i hit https request i have to take permission or i can do that without permission

cold crystal
#

what does 'take permission' mean?

radiant tendon
#

i mean can i send any email to stripe that i am using http request directly not using apis..

#

TypeError: Network request failed

cold crystal
#

what do you mean by 'send any email'?

#

we don't care if you call our API directly instead of using our mobile SDKs, you don't need anything from us or permission.

radiant tendon
#

okay..

#

TypeError: Network request failed

#

const headers = { 'Accept':'application/json','Accept-Charset':'UTF-8','Authorization' : 'Bearer '+publishableKey, 'Stripe-Version' : '2020-08-27'}
const stripeObj = { account : { business_type : 'individual', tos_shown_and_accepted : true}};
const response = await fetch('https://api.stripe.com/v1/tokens', { method: 'POST' ,headers : headers, body : JSON.stringify(stripeObj)})
console.log('Stripe -- > ',response)

cold crystal
#

what is the actual failure?

#

anyway I doubt that code will work — you're posting JSON but our API doesn't actually accept JSON , it has to be x-www-form-urlencoded

radiant tendon
#

yes you are right

#

i am able to generate token in react native thank for your help..

#

i have one question... when we create connect custom account first time for any user we generate token and send it to server to create a account.. but second time when i update anything it is necessary i follow the same approach. if i directly update in account.. is it possible...

cold crystal
#

no you have to use account tokens for updates as well