Payment Gateway
A payment gateway is a merchant service that authorizes card or bank payments for an app. In Hallo Doctor, the payment gateway is used when a user places an order for a doctor’s timeslot.
This guide explains how to set up Stripe payments and the required Stripe webhook.
Prerequisites
- A Stripe account: https://stripe.com/
- Firebase Cloud Functions already set up and deployed from
/Halo_Doctor_Cloud_Function_Firebase
1) Get your Stripe API keys
- Open the Stripe Dashboard (Test mode): https://dashboard.stripe.com/test/dashboard
- Copy the Publishable key (
pk_test_...) and the Secret key (sk_test_...).

Add Publishable key to the Flutter client
Paste your Stripe publishable key into the Flutter project .env file in /Hallo_Doctor_Client_Firebase:
# Stripe
STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key_here
Add Secret key to Firebase Cloud Functions
if your Hallo Doctor version is greater than or equal to 1.1.1 you just need to copy Stripe secret key to .env file at STRIPE_SECRET_KEY=put_your_stripe_key_here
and skip the next step in this page
If your Hallo Doctor version is >= 1.1.1
- back to Firebase Cloud function folder
/Halo_Doctor_Cloud_Function_Firebase - open it with
CMD - run the command below, but change the key to your Stripe Secret Key
# Stripe
STRIPE_SECRET_KEY=sk_test_your_secret_key_here
- now we can deploy it using this command
firebase deploy
<<<<<<< HEAD
If your Hallo Doctor version is <= 1.0.19
Set the functions config value (replace with your secret key):
firebase functions:config:set stripe.token="sk_test_your_secret_key_here"
Deploy:
firebase deploy
2) Create a Stripe webhook endpoint
After your Cloud Functions are deployed, configure a Stripe webhook so Stripe can notify your Firebase server when a payment succeeds (so the app can update the order status to success).
Get your webhook URL from Firebase
- Open Firebase Console → your project → Functions
- Copy the URL shown for the
stripeWebhookfunction.
Add the endpoint in Stripe Dashboard
- Open Stripe Dashboard: https://dashboard.stripe.com/
- Go to Developers → Webhooks
- Click Add endpoint
- Paste the
stripeWebhookURL into Endpoint URL
- Click Select events
- Search and enable
payment_intent.succeeded - Click Add events → Add endpoint
Copy the webhook signing secret
Open the webhook you just created and copy the Signing secret (whsec_...).
3) Add Stripe webhook secret to Firebase Cloud Functions
If your Hallo Doctor version is >= 1.1.1
Add your webhook secret to the Cloud Functions .env:
# Stripe
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_signing_secret_here
Deploy:
firebase deploy
If your Hallo Doctor version is <= 1.0.19
Set the functions config value (replace with your webhook secret):
firebase functions:config:set stripe.webhook_secret="whsec_your_webhook_signing_secret_here"
- now we can deploy it using this command
firebase deploy
Notes on using a different payment gateway
If you want to use a different payment gateway provider, the main integration point is:
lib/app/service/payment_service.dart
You’ll also need a matching server-side implementation in /Halo_Doctor_Cloud_Function_Firebase to create/verify payments and to receive webhook notifications.