In-app purchases: how and where are purchases stored? (Android, iOS) - android

I am aware that apple provides a store for in-app purchases and any user can pull that data from different devices. Is there such a provision for Android apps (Google Market or Amazon App Store)? If so, how do we use this? I've not been able to find any info abt this online. I'm afraid I might have to store purchase information in my own DB. Would that be okay? Anything I need to be aware of?
Thanks!

The Google Market provides a RESTORE_TRANSACTIONS request which returns to you a list of all the (managed) purchases made by the user. You can issue this request on a new install to get the user's list of purchases.
It is very similar to restoring purchases for the iOS in-app purchases.
It only works for managed purchases which means purchases that the user owns forever.
You will still need some kind of local list of purchases as Google recommends you only do RESTORE_TRANSACTIONS on new installs.

Related

In-app purchases (IAP) in android with BOTH Google and Facebook authentication?

In my android application I want to let users to authenticate with google or facebook account.
I've implemented sign-in with google already.
I'll try to implement sign-in with facebook soon.
I've read about IAP in android:
https://developer.android.com/google/play/billing/billing_overview
https://droidmentor.com/inapppurchase-subscription/
at least what I understand it is about google account authentication.
So I wonder is it possible to make IAP in android application if the user is authenticated with facebook account ?
I cant find examples or explanations by now.
Any good examples/explanations about IAP with google is also very appreciated because I still don't have a clear vision on IAP.
fyi: In my app user will be able to buy "virtual tickets pack" (e.g.: 10, 15, 20 tickets) and to add them to their profile. and later they will "consume" tickets one by one.
Best Regards
My understanding is that you already have a user system that you are using to provide a Google login to your customers. When you add Facebook login, you'll probably want to match both Google and Facebook logins with your own custom user ID. It's always a good idea to have a custom ID of your own so that you can map it to different types of logins.
When purchasing through Google Play Billing, the purchase gets associated with the user's phone Google account and you can also provide an optional way of associating a purchase with your own user account system. In order to do that, when building the BillingFlowParams, call setAccountId and pass your account's system custom ID.
To provide the best experience persisting purchases during installs or across devices you should also be saving the purchases on your server's database. In order to do that in a secure manner, you will also have to implement server-side receipt validation. If you want to avoid most of these headaches, I recommend you to use a service like RevenueCat.
IAP can only be done through the user's google account, as that is what one needs to use any part of the Play Store. The user's google account is also where the credit card/other payment methods are stored for each user.
In spite of the above, the way users log into your app has nothing to do with them using the IAP system. When a user will choose to use an IAP, the google account data will be provided by the android device/Play Store, not by your app (Off subject:the process is similar on iOS if you ever get to try there).
What your app needs to do, is receive the confirmation of purchase from the IAP sdk and then mark on your server that this particular user has purchased this item. Basically for any purchases (no matter the payment provider) you would usually mark in your DB the following:
what the user has purchased
how much did he pay
when did he pay
provider's id of the purchase, so you can later match the accounting reports with the payment provider's report
where he payed from (IP can be a good indicator, although in the age of VPNs not necessarily 100% acurate)(this can be useful for your marketing decisions)
mark that this user now has access to the item he purchased and if it is a time limited item, mark when it expires, so you are able to later check if he still has the right to access it.
Disclaimer:
I have not used the android IAP system directly before. I have implemented mobile app payment systems before using iOS IAP and on android Braintree payments. But the process is most likely very similar with android IAPs as well.

Android consumable in app purchase: get user information

Is there a way to check which users bought when a consumable of my app? Not in the app itself but in the developer console/order management. Currently I only see an order id and a token, but would need some custom information or at least the user's email address or sth like that...
Nope. You'll need to link purchases to userIds yourself. Google will link that purchase to the users Play Store account, so they can potentially restore the purchase if they've reinstalled the app or gotten a new phone.
If you don't want to manage your own server, it may be worth using a tool like RevenueCat, that offer a purchase/subscription backend-as-a-service.

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).

How to verify which vender sold my android app?

I have developed an android app which is paid, now i want to sell my app. I have few vendors who will sell for me, I want to validate which vendor sold how many. How can i do it through my app.
To help you start with, I think you need this official documentation for you to understand well the concept.
The In-app Billing API makes it easier for you to integrate In-app
Billing into your applications. The In-app Billing API supports a
synchronous purchase flow, APIs to let you easily track ownership of
consumable goods, and local caching of in-app purchase data.
To manage 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.
If you are using the In-app Billing API, you can also consume managed
items within your application. You would typically implement
consumption for items that can be purchased multiple times (such as
in-game currency, fuel, or magic spells). Once purchased, a managed
item cannot be purchased again until you consume the item, by sending
a consumption request to Google Play. To learn more about in-app
product consumption, see Consuming Items.

How to verify in-app purchase with no user system and no server-side on android?

I didn't find any definitive answer for my situation as all of this kind of questions revolve around server-side verification, which is irrelevant to me.
I'm trying to implement in-app billing in my app in order to offer the option of a premium upgrade. I've followed the guides in the developer documentation and done most of the work.
The problem is purchase verification:
The documentation suggests I shoud pass a developer payload to each purchase to uniquely identify the user - but my app doesn't have or need a user system - how can I uniquely identify a user without requiring user input or extra permissions?
Further and more important problem:
When the user makes a purchase, or opens the app after making a purchase in a different time, I need to verify this purchase - I don't have a server where I can send the purchase data to so it can verify it itself or using the Google Developer API.
It is my understanding that I shouldn't verify the purchase locally on the device (using the Google Developer API).
What is the best way for my situation to verify in-app purchases?
Is there a way to do it without a server? (I do not have the knowledge nor resources to have my own server)
I do not know how you would go about verifying a digital purchase without a network connection. Thankfully though, you do not need a user account system nor do you need the knowledge and resources to have a dedicated server because that is what Google Play services is meant for.
After setting up Google Play services; each user will be signed in through their Google Play account and be able to use their registered payment methods within your app when you implement the In-app Billing API. And you can test and manage all of this information from the Google Play Developer Console.

Categories

Resources