Skip to content

Setup Stripe

Akram El Assas edited this page Apr 27, 2024 · 9 revisions

If you want to enable stripe payment gateway, sign up for a stripe account, fill the forms and save the publishable key and the secret key from stripe dashboard.

Don't expose stripe secret key on a website or embed it in a mobile application. It must be secret and stored securely in the server-side.

In stripe, all accounts have a total of four API keys by default-two for test mode and two for live mode:

  • Test mode secret key: Use this key to authenticate requests on your server when in test mode. By default, you can use this key to perform any API request without restriction.
  • Test mode publishable key: Use this key for testing purposes in your web or mobile app’s client-side code.
  • Live mode secret key: Use this key to authenticate requests on your server when in live mode. By default, you can use this key to perform any API request without restriction.
  • Live mode publishable key: Use this key, when you’re ready to launch your app, in your web or mobile app’s client-side code.

You can find your secret and publishable keys on the API keys page in Stripe Developers Dashboard.

Use only your test API keys for testing and development. This ensures that you don't accidentally modify your live customers or charges.

On production, use HTTPS in the API, the backend, the frontend and the mobile app to be able to use stripe payment gateway.

API

Set stripe secret key in the following option in api/.env:

BC_STRIPE_SECRET_KEY=STRIPE_SECRET_KEY

Frontend

Set stripe publishable key in the following option in frontend/.env:

REACT_APP_BC_STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY

Mobile App

Set stripe publishable key in the following option in mobile/.env:

BC_STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY