how could I check programmatically if the who user is trying to buy in-app billing item is its publisher? - android

When I try to use a in-app billing item its api show that: “The publisher cannot purchase this item”
I want to check in my app if the user is myself, a google Play Store user and the publisher of app, to put all inapp billings items free for me, so how could I check programmatically if the who user is trying to buy in-app billing item is its publisher?

A developer cannot purchase anything from herself. To fully test, you will need to create a test account in the Developer Console and then install your app on a device where that is the primary account. There is no other way. See
http://developer.android.com/google/play/billing/billing_testing.html

Related

How to buy subscription for different app user on same device with single google account using google play billing library v5.1.0?

I have implemented subscription using google play billing library v5.1.0. I am facing issue in handling the following scenario:
User abc#gmail.com login into app and buy subscription for product "sub_plan_100".
Then User abc#gmail.com logout and User xyz#gmail.com login into the app and try to buy subscription for same product "sub_plan_100" in the same android device, which shows the error message like the item is already purchased.
I know the reason why item already purchased is shown to User xyz#gmail.com as susbcription is linked with primary google account used for Playstore.
I want to implement susbcription according to app user not according to google account. Please let me know how can I handle this scenario using Google Play Billing Library v5.1.0
I'm having trouble understanding how can I have multiple users on the same device buy the subscription without changing the device's Google account.

Testing IN-APP PURCHASE With Another account on same device

Good day.I have implemented the in-app purchase flow in my application,added everything necessary to the console but i am failing to test it.Issue is that the android i dont know why uses the non-testing account (developer account) as on the purchase dialog it says 'The publisher can not purcahse this item' but although i have added test account to the device,switched account in the google play but i keep getting this error.Can anyone please tell me what is wrong with it?
If you want to test in-app purchase, you need to account on https://play.google.com, publish your app in alpha version. In IN-APP PRODUCTS, you add products you want, add emails you want to test (only emails in the list can test). You follow this link:
https://developer.android.com/google/play/billing/billing_testing.html

Android in-app billing developer payload

I would like to implement in-app billing in my android app, but I am not sure how should I create for a developer payload. I don't have any information about user, only unique identifier created in the app to recognize it.
Is it possible to restore the purchase when the user buy a product, then uninstall the app and install it again? How to test it, because I didn't get any events when I tried to test it?
Yes, you can check the completed purchase after uninstall app and install it again.
All purchased items stored on the Play Server and particularly in your installed Google Play app. So after item is purchased once the information about purchase is stored and you can request it at any time untill you "consume" this purchase. "Consume" means reset the information about purchase to allow make new purchase with same ID. This is only for v3 if Android Billing Library, because all purchases in v3 are one-off (you can buy it only once) and have to be "consumed" to be purchased again.
The identifier of the purchase item is a simple string that you define in the Google Developer Console. You should login to the developer console, create new project for the future app, upload signed .apk (necessary), after that you have to select the project, move to "In-App products" section and there you can create necessary purchase items with purchase IDs. While purchase action in the application you should pass the matched purchaseID to the launchPurchaseFlow() method on the IabHelper object (these are all from v3 Billing Library). The information about purchased items can also be received by using matched purchaseID.
Official Google developer documentation has pretty decent amount of information about implementing and using Billing Library:
Implementing billing library guide
Administering In-App products in the developer console
Testing In-app billing. Sorry, cannot post link because of lack of reputation (2 links in answer only), but you can also find this section in the official android documentation. This section also has information about testing with special android test purchase IDs which doesn't require signed and uploaded .apk or any actual money-transfers

Remove In-App Billing record from google test account for Testing again

I have created google play test account for testing In-App billing, but the problem is that when i purchase the item and then uninstall app and then install it again on that device and test for In-App billing it gives response that the app is already purchased. So how can i remove the old record of purchasing from test account on Google Developer Console.
Any help will be appreciated.
Since your product is Managed Product by Google therefore your purchased item is already connected to your google account. The best way to get around is to use another gmail account or create a new gmail that you can use to test again.
Secondly, It's always better to test your purchase with static response i.e "android.test.purchased" in your product ID field. If everything goes fine here then try it on Alpha/Beta mode in developer console.

Do in-app purchases show up in Google Checkout?

Regular Google Market purchases of one's apps show up in one's Google Checkout console. Click on Merchant Account and you'll see them.
Do in-app purchases show there as well?
If they do, how about dummy in-app purchases - the ones with dummy item ID (android.test.purchased and the like), and the ones made with designated test accounts?
Yes, all in-app purchases will show up under your Orders tab.
android.test.purchased do not show up in the merchant account. But real item will show up. This is based on my experience.

Categories

Resources