Enable Firebase Billing
🔼 Overview
Firebase provides a range of services, some of which require billing to be enabled, especially OTP login, Google Maps, and Places API. Follow these steps to ensure proper billing setup.
🔼 Upgrade from the Firebase Spark Plan to the Blaze Plan
Regarding Firebase OTP setup — if you've already set up Blaze plan for Firebase OTP previously, there's no need to repeat steps 1 to 3.
Please also ensure that your billing account is linked to your app project. If it isn't, kindly follow these steps (1 to 3 points).
- Log in to the Firebase Console.
- Open your project in the Firebase Console.
- In the bottom left, you will see that your project is listed on the Spark plan. Click the upgrade button.
- Click the upgrade button.
-
Select the Blaze plan.
-
Select a billing account. Then click Continue and Purchase. You are now on the Blaze plan.
- For details on how to create a billing account, please see the Google Billing instructions: 🔗click here
- Select your country instead of India.
- Select your existing payment profile, or click 'Create New Payment Profile' if you don't have one.
- Add details of payment account.
- Select your existing payment method, or click 'Add Payment Method' if you don't have one.
- Select your payment method.
Setting Up Billing on Map and Place API Keys
1️⃣ Set Up Billing
Regarding Firebase OTP and Maps setup — if you've already set up billing for Firebase OTP previously, there's no need to repeat that step. Please ensure that your billing account is linked to your app project. If it isn't, kindly follow these steps (1 to 6 points).
- Go to the Firebase Console.
- Select your project.
- In the left-hand menu, click on Project Settings.
- Under the Billing section, click Go to Billing Account.
- If you don't have a billing account, click Create Billing Account and follow the prompts to add your payment method.
- Link the billing account to your project.
2️⃣ Enable Required APIs
- In the Firebase Console, go to Project Settings > Cloud Messaging > Manage Service Accounts.
- Click on Google Cloud Console, then select your project.
- In the Cloud Console, navigate to APIs & Services > Library.
- Enable the following APIs:
- Maps SDK for Android to display maps on Android devices
- Maps SDK for iOS to display maps on iOS devices
- Geocoding API for converting addresses into coordinates (optional)
- Places API for location search and autocomplete
- Routes API for calculating distance between locations
warningDistance Matrix API is now deprecated, so it's necessary to enable the Routes API.
- Maps JavaScript API for displaying maps
- Maps SDK for Android to display maps on Android devices
3️⃣ Set Up API Keys
-
In the Cloud Console, navigate to APIs & Services > Credentials.
-
Click Create Credentials and select API Key.
-
API Key Management for Android, iOS, and Place Services (remove Restrictions from Android, iOS and Place Search API newly created), Please Ignore if Already Unrestricted.
4️⃣ Add the API Key to Your App
-
In your Flutter app, locate the AndroidManifest.xml (for Android) or AppDelegate.swift (for iOS).
- Insert your API key:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_ANDROID_MAP_API_KEY" />android/app/src/main/AndroidManifest.xml
-
For iOS, add the key in AppDelegate.swift:
GMSServices.provideAPIKey("YOUR_IOS_MAP_API_KEY")
ios/Runner/AppDelegate.swift
5️⃣ Verify Billing Setup
- In the Cloud Console, go to Billing and ensure the project is linked to your billing account.
- Test OTP, Map, and Place APIs in your app to ensure they work properly.