#kamran-reactnative
1 messages · Page 1 of 1 (latest)
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
yes I know
I read your messages!
I haven't seen this error before. Can you share the full stack trace for it?
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
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
Documentation for @stripe/stripe-react-native
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);
yep you can't do this yet in our React Native library unfortunately
https://github.com/stripe/stripe-react-native/issues/427 is where we're tracking this but it's not supported yet
so help me out.. how can i create custom account..
because in France we have to initialise token first.
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
I'd build a website for this instead and use stripe.js there https://stripe.com/docs/connect/account-tokens since you can't really do this in our React Native app today
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
how can i do.. can you guide me how can i directly call /v1/token
any documentation
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
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!
yes i understand..
but for http call
i need request parameters and complete url..
so an you guide me that..
I can't really share more than I already did
okay thank you..
one thing plz
on serverside..
i first create token and then create account..
it is working...
so is it right approach..?
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)
hmm..
really sorry, I know it's not a great situation!
okay. tell me if i generate token on client side. and in future i want to update client information. what would be the procedure..
you'd create a new token with the updated information and use https://stripe.com/docs/api/accounts/update#update_account-account_token
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.
ya we want to use custom account.. we create our own stripe account manage bank account and do payouts..
tell if i hit https request i have to take permission or i can do that without permission
what does 'take permission' mean?
i mean can i send any email to stripe that i am using http request directly not using apis..
TypeError: Network request failed
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.
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)
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
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...
no you have to use account tokens for updates as well