I’m very new to programming, I know I’m not supposed to ask here, but I really got lost, I’m building a food ordering app with Expo and the only thing left for me is to add Stripe and building the iOS and android projects. I’m really confused on what are the next steps, some people talk about ejecting and then developing Stripe. The expo documentation just provides examples in TypeScript, and my project is in JavaScript. And the Stripe documentation talks about a “server-side” which I still can’t understand how it works, for example, when I launch then my app in the stores, do I have to run the server in my computer separately at all times when the app launches? Also I should add that I’m using Firebase for Authentication and Databases. If someone could provide me good tutorials or have some suggestions I’d be glad, thanks
CodePudding user response:
Usually StackOverflow is for very specific question, not "global" how-tos, I won't then write code for you, but will try to explain as much as I can.
First of all welcome to the amazing world of programming ! One of my mentor oftenly says "Developer can change the world with a text editor".
Concerning your Expo App : No you don not need to eject to use Stripe, the great expo team is providing a brigde between @stripe/stripe-react-native and expo. You can read more here.
For the demo, just remove the typescript params, it should work like a charm (thus, as you're new to programming, I strongly recommend you to check typescript, as it's (almost) now a standard for JS programming, both front and backend).
For the backend part, yes, you'll have to create your own, raw - using the JS runtime Node.js (Express, Nest, Koa...), PHP, Python or any language you're familiar with, or a "serverless" one, you've mentionned Firebase, it's one of it, bit there're many solutions out there (AWS Lambdas...)
Of course, you won't have a backend on your computer, but on a dedicated server which will handle every call from your app serving from 'https://myapi.mydomain.com/what/to/do'. Imagine your app as a shop, a visitor can see shoes, try them, and if he/she wants it, he has to pay.
And here, usually the shop needs some customer informations (for retargeting) and stock management (Hey ! 4 customers has bought Shoes #42 in Size #4 and Color #17, we should reorder some), that requires a bit a security and business logic (confirm payments, send orders, ...).
Concerning Stripe, you'll need a backend to create a Customer cus_XXX
, create a Payment Intent, send it back to your app and confirm it then (for Europe 3D Secure, or SCA stuff), it's slightly more complicated, i took the quickest path.
For the tutorials, there's PLENTY, if you can afford $10 to $50 check the insanely good ones from Udemy or Pluralsight otherwise, check Medium or just ... Google it with "Node.js getting started".
As you're new in programming, and as SO is slightly for more "advanced" peeps, I'd recommend you to find some dev community on Slack / Discord, you'll probably more "welcomed". At some point we're all the junior of someone, but this place is - once more - for very specific questions ;)
Happy programming !