We all know about Admob Ads very well. Here, I would like to explain what mediation features and how it will be useful for developers. Let’s take a simple one …
Before we start with app purchase, Let’s get a basic idea of what type of digital content we are selling to users.
Consumable product is the one that is consumed in due time and you will purchase it again, Like a game currency in a gaming app, when the user consumes the product, your app dispenses associated content and the user can then purchase that item again.
Non Consumable Products is the one in which users can buy permanent benefits of purchase, without need of buying it again and again.
SubScription : it is a product that provides access on a recurring basis, subscription is not cancelled until the user does not cancel it, for example, music streaming services.
The google play console offers lot of flexibility when creating subscription products,
Log in to your google developer account : with link https://play.google.com/apps/publish/
Click settings tab from the menu on left
Scroll down to the bottom of this page and you will see a link to activate your account, when your merchant account is activated, it will look like this
We are using this library from git repo :
Open android Manifest.xml and add billing permission in it
Upload this app in your developer account
From Left menu in your developer account console, select all applications and select your app in which you are applied to in app purchase to.
From the menu on the left select services and APIs found under development tools
Copy the license key found under section titled “Your license key for this application”
Upload your license/Billing key to the commerce section of your app’s control panel
Now your merchant account is activated and your Licensing/Billing key is also uploaded, before adding products to your app, your app version must be uploaded that has a billing /license key included.
Go to google developer console and select your app from all applications
if your app was already live on play store, you are now just including your in app purchases, in app products is found under “Store presence” tab in your app’s listing
Make sure subscription tab is selected for adding subscription, then click on “Create Subscription”
Add your product id : product id must be composed of lower letters(a-z), numbers(0-9), Underlies(_), or dots, without any spaces, and it should start with lower letters or numbers.
Input your title and description, then change status to active.
Set a price and billing period and save product
Now in your app’s control panel, step into the commerce section from the menu on the left. Copy and paste your product id into google play product id field,
And click add button to save it
As you already added billing library in gradle and billing permission in android manifest.xml,
Now create an instance of Billing Processor class and implement callback in your activity class, Constructor will take these three parameter
1, Context 2, Your licensing key from google developer console, 3, IBillingHandler interface implementation to handle purchase results and errors
Here billingProcessor. isIabServiceAvailable() is used to check if a google play store app is there in your device or not.
You will get four override methods for implemented interface
Override activity’s OnActivity method
Call purchase method for a billing processor instance to initiate purchase or subscribe method to initiate subscription
For subscribe or purchase method, you need your product id as a parameter needed to pass nad context
Don’t forget to release your billing processor instance in onDestroy method, once it’s work is done.
That’s it, if you have your purchase successful you will get your transaction details in onProductPurchased methods, from there you will get the State of your product also there, and depending on your product state you will update your app ui.
Let’s Nurture, a top mobile app development company in India has got the expertise in providing many solutions based applications with E-Commerce, Social Networking, Health sector, IoT & Machine learning. Our team at LetsNurture provides best solutions for business (saving time), shopping experience, teaching experience and many more. If you want to know more about this technology in your existing mobile app, get a free consultation from our experts at Let’s Nurture.
With our hectic lifestyles and the need to physically distance due to the ongoing pandemic, on-demand app services are rising in popularity. One such category for this niche is on-demand …
The Novel Coronavirus epidemic that has spread its tentacles worldwide almost brought business and the economy to its knees. With no way of attending office, how are employees supposed to …
Coronavirus has literally crippled the economies of different countries catastrophically and has forced many industries to put down their shutters for long. Some have closed down temporarily abiding by the …
The COVID-19 pandemic raises many problems in the domain of Artificial Intelligence (AI). The major challenges are often raised by way of so many pertinent questions such as, can AI …
According to recent google reports, 114 countries have reported that 1,18,000 have contracted Covid-19, the disease caused by the virus, known as SARS-CoV2. Nearly 4,300 people have died. Introduction Where …
There has been an explosion in the use of chatbots across both business websites and messaging applications, mainly because businesses want to cater to their customers and customers have a …
According to Econsultancy, following the personalization of metasearch engine, 93 percent of organizations experienced an increase in transformation rates. Personalization depicts the system and strategies of conveying the content and …
Though a bad reputation has developed over the years, outsourcing is on the rise and for good reason: it is a sound financial strategy for companies, of all sizes and …
In the era of wireless technology, where there are more mobile phones than people, mobile applications play an important role for rural women to improve their maternal health. Technology is …