Before doing firebase setup, we need to install firebase tools on your machine. To do that, please execute
npm install -g firebase-tools
Step 1: Create new folder & login to firebase
mkdir fcf cd fcf firebase login firebase init functions
It might asks your few questions, please answer as followed
– Choose your firebase project
– Language: JavaScript
– EsLint: No
– Npm install: Yes
Step 2:
Once it’s project is created, please follow this
cd functions npm install --save firebase-admin npm install --save firebase-functions npm install --save stripe
Step 3:
Then replace your newly created index.js with downloaded index.js & also update your stripe api key inside index.js
Step 4:
Update your stripe keys with following files (stripe key which you can get from https://stripe.com/)
functions/index.js
rider/src/index.html
Step 5:
cd .. firebase deploy --only functions
Note: You must be inside fcf/ (not inside fcf/functions) folder for deploying.
Important
- Stripe only works on supported countries (https://stripe.com/global)
- Stripe won’t work on firebase free plan, u need to upgrade to flame or blaze