Android In app billing purchase history query - android

I am building an app that I want to use Google in app billing for. Does Google track in-app purchase history for me, so that I can query history and get data, say, by date or by item, etc. Or must my app itself store user's purchase history on my own backend? Also, if you can please provide a link so I can verify this info.

For your question answer is both YES and NO Google will take care of all purchases based on product type. If you are using Non-consumable or Subscription based products Google will keep records, in other case if you are using Consumable products Google will keep it's record till your app consumes that product.
If your app sends a purchase request Google will associate it with primary gmail account registered on android device and will not allow to purchase same product twice.
NOTE:- If You are using IAB-2 then above product type and flow will slightly different
Non-consumable ** is known as **Managed Products
*Subscription* is same as Subscription
*Consumable* is known as Unmanaged products
In case of IAB-2 google will never keep record of Unmanaged products and it is your responsibility to keep records if you want.
For more details see below link to developer guide.
Developer guide

Related

How to verify user purchased premium version using in app product in android?

I have developed an app in which I want to give a premium version of an app with ad removal and some extra features in-app products.
So, my question is how to verify if a user had purchased already; Then, when a user opens the app, I know if I should give them a premium interface.
Here's the documentation overview for In App Billing, where it says:
Google Play tracks and manages the ownership information of managed products. When a user purchases a managed product, Google Play stores the purchase information for each product on a per-user basis. This enables you to later query Google Play at any time to restore the state of the products a specific user has purchased. This information is persistent on the Google Play servers even if the user uninstalls the application or if they change devices.
To provide premium content, you'll need to create a managed product that doesn't get consumed in the app when the user purchases it. In order to query the user's in-app purchases, send a getPurchases() request, that will return all the current un-consumed products owned by the user.
If you find the premium content in this response, you know the user has purchased it and can grant them the premium interface.
Google Play Billing AIDL is now deprecated and will be removed in a future release. To implement Google Play Billing features, use the Google Play Billing library and to get purchases details for all the items bought within your app use: queryPurchases(skuType).

Google Play Billing: identifying duplicate transactions

Is there any way to see if an in-app transaction concerns with an item already owned by a user? Our reports get a bunch of duplicate transactions due to people re-purchasing stuff (after removing the app or switching user accounts) – they don't get charged on Google side for purchasing the unconsumed items multiple times and we need a way to know that.
We tried the following ways:
OrderId field from purchase receipt – seems to be unique every time,
even if the item is already owned.
PurchaseToken – despite having a
number of formats, it seems to be the same for transactions that
involve purchasing the same item by the same person, however a
few of our users still get unique purchase tokens every time they
"purchase".
Is there any way to tell if in-app purchase of this product has already happened in the past (like referring to transaction_id field from original iTunes receipt in Apple ecosystem)?
Is there any way to tell if in-app purchase of this product has
already happened in the past?
AFAIK the In-app billing API doesn't provide such info for consumed products (I assume you use products and not subscriptions).
The cases are:
For non consumed products you should get RESPONSE_CODE with value 7 - ITEM_ALREADY_OWNED from the getBuyIntent method, so you might just not consume the products on the client side and just keep them indefinitely.
For consumed products you might want to save the product SKU (productId) on your app, or associate it with some kind of user account if your system uses user sessions. That way, with the next attempt to buy the product you can match the SKU and just programatically disallow the app to start the intent sender for buying a specified SKU product.
Both orderId and purchaseToken should be unique for a given transaction. They are for further use, for example with the Google Developer API, ie: https://developers.google.com/android-publisher/api-ref/purchases/products/get (see token in request params).
Alternatively you might use the said developer API and optional developerPayload field (however you wish to do that) to match users of your system and play store transactions.

Does android playstore support non-renewing subscription?

My Question is can we provide the feature of non-renewing subscription in our android app??
so the user will be notified through mail that his/her subscription has been expired so he will resubscribe it manually as IOS does.
Yes, it does. see description from Android official doc:
You can create a product list of digital goods that are associated
with your application, including items for one-time purchase and
recurring subscriptions. For each item, you can define information
such as the item’s unique product ID (also called its SKU), product
type, pricing, description, and how Google Play should handle and
track purchases for that product.
It means there are two types:
Standard in-app products (one-time billing)
Subscriptions, (recurring, automated billing)
See detail doc here:
http://developer.android.com/google/play/billing/index.html
Hopefully, it could help you.

Android InApp Billing v3 cancel consumption

I have working app that sells in-app products (InApp billing v3).
Recently I've made an update for this app and made a terrible mistake there: I consumed some of purchases I didn't want to consume.
I issued an update and users updated the app and then wrote me they have no purchased access. (As I found later, I consumed wrong items).
So I have some questions now:
Is there a way to restore consumed purchases or I should return payments to my users?
Is there a way to find out how many and which purchases were consumed?
If returning payments, is there a way to find out if user still has the product or is it consumed with out changing the app (through google services)?
Thanks.
According to what I have understood from your question, It seems like you want to purchase product only once.
What I wished to ask: is there a way to request information about consumed products like about owned products.
you can get response or it's information in any type(Managed Product, Unmanaged Product, Subscription) in the onActivityResult method() check my below link.
In-app billing-v3 error in activity result
but I would not prefer you to manage it customly as you told for one time purchase product(not consumable product). You should go with the Manage product.
Managed In-app Products:
Managed in-app products are items that have their ownership
information tracked and managed by Google Play. When a user purchases
a managed in-app item, Google Play stores the purchase information for
each item on a per-user basis. This enables you to later query Google
Play at any time to restore the state of the items a specific user has
purchased. This information is persistent on the Google Play servers
even if the user uninstalls the application or if they change devices.
for more information about product type
you can query any time you want and you will get the product information, and even you don't need to manage if user has already purchase this product or not.
Is there a way to restore cnsumed purchases or I should return payments to my users?
Better option is you should give the payments back to the user and for the next time check the whole app once using dummy product "android.test.purchased" and update your app.
Is there a wat to find out how many and which purchases were consumed?
You have to check in the Google wallet because all transaction should be handle by the it, check if it gives you product type or not. Using your google developer console credential you can signed into google wallet.
If returning payments is there a way to find out if user stil has the product or is it consumed with out changing the app (through google services)?
as per above answer you have to check in google wallet, according to my knowledge they are provide us all of information about product type with user detail.
Let me know if I have not properly understood your question.
Hope it will solve your problem.

Get in-app billing user account details

I'm creating an Android application that implements subscriptions to digital content on my backend server. What I wish to do is obtain the name and email associated with the Play account that made the purchase, namely the same information I can get if I go to my Merchant account and view an order.
Using the TrivialDrive in-app billing example, I'm able to access the INAPP_PURCHASE_DATA and send that information to my backend server as the "Checking Subscription Documentation" recommends: http://developer.android.com/google/play/billing/v2/billing_subscriptions.html
The documentation lists a typical implementation workflow and says:
When the user successfully purchases a new subscription, your app
notifies a backend server, which stores the purchase token, user name,
and other information in a secure location.
Although I can store the purchase token, and other INAPP_PURCHASE_DATA how do I obtain the user name or email for that matter. From what I can piece togehter I suspect the account details like user name, email, subscripion expiration date must be requested from my back end server. It seems using the purchase token on my backend server is the key to accessing order information, but at this point I haven't found any clear way to go about doing this.
Any suggestions would be appreciated.
Regards
There is an example on the Android Developer site here: Google Play In-app Billing
Testing In-app Billing
Administering In-app Billing
After that Adding items one at a time to a product list
like this
In-app Billing Reference
Then review this Agreement
Helpful links refund policy, In-app Billing, Implementing In-app Billing
Pls tell if you still facing the some problem :)
Thanks

Categories

Resources