logo

GOOGLE IN-APP PURCHASE SUBSCRIPTION

With a Google In-App Purchase Subscription, app owners can make money from their apps. Users can download your app for free, and then they can make additional purchases in your app by adding subscriptions to a specific ChannelChat Group or Bot.

Adding a Subscription to a Channel, Chat Group or Bot

Make sure to install one or more of these components in your Navigation or Side Menu.
Image without caption
Click 'Channels’.
Image without caption
Click the channel to set up payment.
Image without caption
Turn the toggle on, enter your product ID, choose your subscription period, add your price, and choose your currency.
Image without caption
You can do the same thing with group chat and bots.

Add Subscriptions as Products in the Google Play Console

Go to Google Play Console and select your app.
Image without caption
From the left side menu, scroll down until you reach the ‘Products’ section and click ‘Subscriptions’.
Image without caption
Click ‘Create subscription’.
Image without caption
  • Add product ID: Add channel_sub. Make sure to match it to the SKU you added to your channel. According to Google guides, it MUST start with a number or lowercase letter.
  • Add Name.
And click ‘Create’.
Image without caption
On the same page of the subscription, click ‘Add Base Plan’.
Image without caption

Base Plan

  • Add Base Plan ID: channel-monthly-subscription-plan.
👉
Make the grace period None
  • Choose ‘Charge at next billing date’.
  • Allow resubscription.
Image without caption

Price and availability

Set up your price and choose your targeted regions. Click ‘Set price’.
Image without caption
Mark countries and click ‘Set price’.
Image without caption
Make sure to match the currency setting with the currency you chose in your channel or chat group.
Image without caption
Click ‘Save’.
Image without caption
Then click ‘Activate’.
Image without caption
Here are more details regarding Google's subscription creation.

Linking Subscription Purchases with nandbox App Builder

After making your subscription, you need to link your account to a Google Developer Project.
⚠️
You MUST be the owner of the Google Play Console account in order to continue with the following steps; other invited users, regardless of their account privileges, will not be able to access this section.
These setup steps are for one time only.
Go to Google Play Console from the left-hand side menu, scroll down until you reach ‘Setup’, slide the menu down, and click ‘API access’.
[Continue from here; we need access from Hazem]
Image without caption
Click ‘Create a new Google Cloud project’, then click ‘Save’.
Image without caption
The Google Cloud Project instantly connects to your Google Play Developer Account. Click ‘View in Google Cloud Platform’.
Image without caption
Click ‘View all products’.
Image without caption
Scroll down till you reach ‘Analytics’, and select ‘Pub/ Sub’.
Image without caption
Click ‘Create Topic’.
Image without caption
  • Add Topic ID. [ChannelSubscriptionsTopic]
  • Mark ‘Add a default subscription’.
  • Mark ‘Google-managed encryption key’.
  • Then click ‘Create’.
Image without caption
From the ‘Topic’ page, go to the ‘INFO PANEL’ on the right, select ‘PERMISSIONS’, and click ‘ADD PRINCIPAL’.
Image without caption
  • Add New Principal:
MANDATORY!
Add google-play-developer-notifications@system.gserviceaccount.com.
  • Select a role: Pub/Sub => Pub/Sub Publisher
Image without caption
Then click ‘Save’.
Image without caption
Copy the topic name and save it for later.
Image without caption
Then go back and click on your topic to add your subscription.
Image without caption
Add subscription ID: nandboxbackend
  • Mark ‘Push’
  • Add the nandbox Endpoint URL:
MANDATORY!
Image without caption
Skip the rest of the required information and click ‘Create’.
Image without caption
Make sure to refresh your Google Console page and select ‘API access’ to check all your changes.
Go back to your Google Play Console, select your app, and then select ‘Monetization setup’.
Image without caption
Paste the topic name you copied before. You can also send a test notification to verify your proper configuration.
Image without caption
Once tested, click "Save changes".
Image without caption

Create a Service Account

We use a service account to verify the in-app purchases.
Go back to Google Cloud, click ‘IAM and admin’ and click ‘CREATE SERVICE ACCOUNT’.
Image without caption
  • Add service account name: SubscriptionsBackendService
  • Add service account ID: SubscriptionsBackendService
  • Click ‘CREATE AND CONTINUE’.
Image without caption
  • Select a role: Scroll down till you find ‘Project’, hover over it, select ‘Editor’, and click ‘Done’.
Image without caption

Adding Key

Click on your created service account.
Image without caption
Go to the ‘Key’ page, click ‘ADD KEY’, choose ‘JSON’, then click 'Create'.
Image without caption
Your JSON file will be downloaded automatically once you click ‘Create’. Make sure to save it for later.
From your Google Console account, go to the ‘API access’ page and click ‘Manage Play Console Permissions’ for the service account you created.
Image without caption
Mark all financial data permissions.
Image without caption
And click ‘Send invitation’.
Image without caption
Go back to your App Builder; on the ‘App Settings’ page, turn the toggle of in-app purchases on, and click the gear icon to open the settings.
Image without caption
Upload the JSON file you downloaded before, then click ‘Submit’.
Image without caption
That concludes your task!

Test your Subscription before Publishing

One of Google's features, license testing, allows you to test payments made in your app without having to use real money.
Note that before implementing these steps, you need to upload your app bundle to the internal testing section FIRST. Check out this document for testing your app via the internal testing feature.
From your Google Play console dashboard, select 'License testing'.
Image without caption
You can add yourself to a list, mark it on the list, and click 'Save changes'.
Image without caption
Make sure that payment methods are turned on so that users can pay for subscriptions that way.
Image without caption

  • If you schedule your channel subscription to run every week, license testing will aim to speed up the process by reducing the duration to just 5 minutes. Additionally, one month will be 5 minutes, three months will be 10 minutes, six months will be 15 minutes, and a year will be 30 minutes.
  • One advantage of licensing testing is that when you test your subscription payment, you will be asked if you want to examine what your users would see in both successful and unsuccessful payment scenarios.