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
Related
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")
I am using the in-app billing in my android application, but I do not know how to integrate the in-app promotion with my app. I have tried to read this resource here, but I didn't understand any thing. the application is providing the payment methods except the redeem, please any help how to integrate it?
note: I'm using in-app billing v3
Integration of the in-app promotion with App Google provided a descriptive documentation which you can refer to implement in-app promotion.
Official Documentation says,
If your app supports the in-app purchase workflow(described in Making In-app Billing requests), your app
automatically supports in-app redemption of promo codes.
Here are some details
Supporting Promo Codes in Your App
To support promotion codes, your app must call the getPurchases() method whenever the app starts or resumes. This method returns a bundle of all current, unconsumed purchases, including purchases the user made by redeeming a promo code.
Calling getPurchases() on startup and resume guarantees that your app finds out about all purchases and redemptions the user may have made while the app wasn't running. Furthermore, if a user makes a purchase while the app is running and your app misses it for any reason, your app still finds out about the purchase the next time the activity resumes and calls getPurchases().
Refer this documentation for more details
https://developer.android.com/google/play/billing/billing_promotions.html#supporting
This is the checkbox you have to tick before creating promotion codes:
My app integrates In-app Promotions.
This requirement is very misleading. There's no such thing as in-app promotion integration. If your app integrates in-app purchases your are ready to go. I spent half an hour before realizing my app was already supporting in-app promotions because it simply supports in-app purchases
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
I need to integrate google play in-app purchases with my server-side billing.
Any way to get list of in-app purchases via some Google Play API to my server without client app in between?
Tried to find anything relevant in documentation and all I found is status check API which gives you status of specific purchase, but I need to get list of purchases too.
Okay, it's possible via Callback functions in Integration tab of Settings page but only if you have classic Google Checkout account.
If you just registered as Android Developer — you have a different type of account and those options are unavailable for you.
No way to sign up for classic account as Google Checkout is being substituted by Google Wallet and no way to change account time once you are registered.
sarcasm on:Thank you, Google!:sarcasm off
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.