As the ongoing pandemic continues to push consumers to shop online and get delivery directly to their homes in a bid to stay safe from the spread of Covid-19, online …
Continue reading “6 Business Models That Online Marketplaces Use to Earn Money”
07
Dec. 201.88 K
VIEWSBefore 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.