Implementing google in-app subscription - android

The developer guide gives the sample for in-app billing, and for the subscription it takes for the same sample application, and saying to modify it for subscription.I want to modify this "Dungeons" sample application for subscription, But in the developer guide there is no info for modifying this sample to subscription. What should i change for same.I want to know complete steps for modifying this sample. Please help.
Thanks in advance.

if you implement your InApp Product Purchase with old billing API.
then
update the billing API code to version 2
not much change in the InApp subscription. other then mBillingService.requestPurchase(productId, Consts.ITEM_TYPE_SUBSCRIPTION, null)
To check subscribed items, you can use Restore purchases. In App subscriptions also act as a `InApp Products'
I hope it helps you.

Related

Flutter IAP subscription

I'm trying to setup a subscription IAP for my app. I have managed to purchase the sub via my app. The next stage is being able to edit the subscription and display details on the subscription via the app. I can't find much details on this here, or in the in_app_purchase documentation.
Does anyone know how to do this, or what the best practices are?
Many thanks.
The Google play billing guide gives a comprehensive guide on how to handle this.
Essentially, let the user edit their subscription via Google Play.
I did this simply using the url_launcher package as follows:
launch("https://play.google.com/store/account/subscriptions")

Why does queryPurchaseHistoryAsync not work with promo codes?

I have been only using queryPurchaseHistoryAsync for in-app purchases on Android and it has been working fine. After using a promo code I noticed that it is not seen by my code. Is there a reason for this? Normally this function should return all recent purchases and redeeming code is a recent purchase. What am I missing here?
If you can provide the sample code of your it would be more helpful for more to find you a solution
At the same time hope this link provide more information to Support promo codes in your app
which version of the google play billing api you are on, from the method name, he should be on the new one
https://developer.android.com/google/play/billing/billing_overview

How to check if the user has bought a subscription

in my android app i implemented the in App-Billing, where the user can buy a subscription in the app.
when the user launch the app, i want to check if he has any subscription at all, to decide which content should i show him.
i'm using the latest in-app-billing library implementation 'com.android.billingclient:billing:1.1'
thank you in advance for the help
You have two options
Create a WebAPI as Google suggest having a separate server which tracks users purchases and communicates with the Google APIs. Refer LINK.
Use Google's InApp billing library to get users subscription.
Refer this answer. It will give you some idea of In-app purchase workflow.
I also suggest you go through some articles about InApp purchase.
Tutorial: How to Implement In-app Billing in Android LINK
Article on implementing InApp purchase LINK.
How to verify purchase for android app in server side (google play in app billing v3) LINK.
Another SO answer LINK
Another SO answer LINK
Code Project Sample LINK.
my goal was to find out, if the user has a subscription at all.
i have resolved it like this.
mBillingManager = new BillingManager(this);
Purchase.PurchasesResult purchasesResult = mBillingManager.getPurchaseMadeByUser();
if(purchasesResult.getResponseCode() == BillingClient.BillingResponse.OK && (purchasesResult.getPurchasesList() != null)){
hasSubscription = true;
}
and everywhere in the app, i check if hasSubscription == true then don't load the ads.
to set up the In-App Billing in my App, i followed this Tutorial from Google :
https://codelabs.developers.google.com/codelabs/play-billing-codelab/#0

How to implement in-app purchase of application Android?

I have created a android application. Subscription is free. However I have put ads inside application. Now I want provide option within app where people can buy ad-free version. And also provide option to restore purchase.
I went through Android docs didn't understand anything. Please provide a good tutorial.
Hey I had worked on InApp Purchase recently and I've successfully integrated in my existing app and ready to make it live. Initially when i had started doing this I've downloaded google InApp Billing Example called "Trivial Drive" from here.
But it didn't help me much as it has lots of issues and bugs, So I've decided do it on my own from scratch using new v3 api which you can find here. This tutorial has clear explanation that would help you and also if you have time, see this youtube video where google employee had explained clearly how to integrate it.
Also if you want quick example, I've a sample app which you can download from here.
The following video also explains how to integrate InApp Purchase. Please go through it.
https://www.youtube.com/watch?v=-h2ESH71hAI
Thank you
Refer this question on SO Implementing In App purchases in Android?. Also for official documentation of The In-app Billing Version 3 API refer this link http://developer.android.com/google/play/billing/api.html
This is how you create In app purchase inside your app.
1) In your developers console, go to your application and create a in app product(Name it as Ad-Free Access or what ever).(Note: to create a in app product you need to have a merchant account).
2) If you have a merchant account ready, create a InApp Product with the type of Subscription(One time or monthly or yearly) and price.
3) Once you have created the InApp product successfully, you can prompt the user to purchase an InApp product by quering a list of in app products in your app and ask user to purchase them.
Here is a link to query the InApp products:
4) Once a user purchase the product, based on the purchase status of the product, you can disable the ads in your app.
The Simple and very easy way to implement in-app through a library anjilab.
Just add the dependecy
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
Add Permission, implement methods and you done.
For any issues you can see here
issues

How to implement subcription in Android SDK

In the app can we add a yearly subscription method, so that it stop working each year if subscription is off Or the current year payment won't went successful.
Any Ideas would be helpful.
Thanks in advance.
You could use In-App Billing
Alternatively, if you allow your customers to create an account on your web site. They could pay you there and you could use your own servers to verify the subscription by calling it from the app.

Categories

Resources