A sample app showing how to use the Tipsi-Stripe library for handling payments in React Native with a Lumen PHP backend.
You can read the tutorial at: Accepting payments in React Native
- React Native development environment or Expo
- PHP development environment - you can use either Laravel Homestead or Valet.
- Ngrok account
- Google Play developer console account
- Apple developer account
- Stripe account
- MySQL database manager - DBeaver, SequelPro
- Clone the repo:
git clone https://github.com/anchetaWern/RNPay.git
- Install the dependencies:
cd RNPay
yarn install
react-native eject
react-native link
- Create a new Lumen project:
composer create-project --prefer-dist laravel/lumen RNPayBackend
-
Copy the files from the
server/RNPayBackend
directory to the newly generatedRNPayBackend
folder. -
Create the
rnpay
database with a MySQL database manager of your choice. -
Update the
.env
file with the database config and Stripe secret key:
DB_USERNAME=YOUR_DB_USER
DB_PASSWORD=YOUR_DB_PASSWORD
STRIPE_SECRET_KEY=YOUR_STRIPE_SECRET_KEY
- Run the migration:
php artisan migrate
- Expose the server with ngrok:
ngrok http -host-header=rewrite rnpay.test:80
- Go inside the
RNPay
directory and update the.env
file with your Stripe publishable key:
STRIPE_PUBLISHABLE_KEY=YOUR_STRIPE_PUBLISHABLE_KEY
- Update the
src/helpers/pay.js
file with your ngrok URL:
const endpoint = 'https://YOUR_NGROK_URL/charge';
- Run the app:
react-native run-android
If this project helped you reduce time to develop, please consider buying me a cup of coffee :)