Android In App Billing ... Why is there conflicting information?

I, like many others, just try to check my in-app purchases after verifying that static responses work. But, reading documents, messages and answers, it seems nothing adds up. And I'm very upset.

My ultimate goal is to find out if I can test without charging.

This document says I can - link

After authorization with access to testing, these users can download your application and test the full amount of merchandising, purchase and execution for your products. Test purchases are real orders, and Google Play processes them in the same way as other orders. When the purchase is completed, Google Play does not allow orders to go to financial processing , guaranteeing that there will be no actual costs for user accounts , and automatically cancels completed orders after 14 days,

same links

During the test purchase, users can test the actual flow of merchandising, purchase and execution in your application. At the time of purchase, the inapp item is displayed as a regular item with the actual price. However, Google Play notes purchase tests with a notification in the center of the purchase dialog, for easy identification

But then this page says - link

Log in to the test device using your tester account. Test the In-app Billing app by purchasing a few items and fix all the problems you encounter. Do not forget to return your purchases if you do not want your testers to be actually charged!

WTF ... so does anyone know? Is testing free of charge? And if so, how?

+4
source share
3 answers

if you use application billing in version 3, you can simply use the product id = "android.test.purchased" . This is a dummy product and you should not add it to the developer console. You can buy this product without any fees.

android.test.purchased

When you make an In-app payment request with this product ID, Google Play responds as if you had successfully purchased the product. The response includes a JSON string containing fake purchase information (for example, fake order ID). In some cases, the JSON string is signed and the response includes a signature, so you can test the implementation of signature verification using these answers.

Hope this helps you.

+2
source

Yes. You can make trial purchases, without requiring any payments, for real items (SKUs) that you actually defined in the Console. I just did it myself.

Unlike the recommendations in the currently accepted answer, there is no need to use the dummy SKU android.test.purchased , as with static testing.

OP cites this paragraph:

During the test purchase, users can test the actual flow of merchandising, purchase and execution in your application. At the time of purchase, the inapp item is displayed as a regular item with the actual price. However, Google Play marks tests with a notification in the center of the purchase dialog, for ease of identification

This is still correct and consistent with what I was able to achieve.

But the subsequent paragraph of OP cites:

Log in to the test device using your tester account. Test the In-app Billing app by purchasing a few items and fix all the problems you encounter. Do not forget to return your purchases if you do not want your testers to be actually charged!

This, as far as I know (especially the last sentence), is wrong.

What you can do according to the first paragraph. That is, while the test account is added to the Console as a tester, then when trying to make a purchase, the dialogue (which shows you the price, etc.) should also have a special line in the center (for example, as mentioned in the first paragraph), in which says: "This is a test order, you will not be charged."

However, in order to actually perform this work, it is also necessary that the actual APK tester (or test device) is used in order to be loaded into the alpha channel.

So the steps I took were as follows:

  • Create a separate Google group to test your alpha channel.

  • Add your IAP user gmail account to this group.

  • Download the APK (exported and signed with the release certificate) application purchase code in the alpha channel.

  • Wait maybe an hour or two for the alpha build to become active.

  • At the same time, set up a separate test device on which only the test gmail account is installed.

  • Stop testing the alpha channel by going to the select URL on the test device when you are logged in as a test user.

  • Log in to the game with this account and install the application from Play. At this point (or in an hour or two), the very latest alpha you downloaded should be installed.

  • Trying to make a purchase. When the dialogue appears with the price, it should have an additional line "This is a test order that you will not be charged."

In fact, to be completely accurate, the test device did not have to have the alpha APK installed on Play. From my tests, it is important that you have an APK downloaded as alpha, and that the APK that you use on the test device has the same version number. In addition, the user under test must be configured for alpha build and added as a tester in the console (as described above). I just exported another modified version of my APK and booted into my test device using adb install , and I can still try shopping for real SKUs with the message "... you will not pay."

+2
source

You must consume after purchase.

 consume.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Thread t = new Thread(new Runnable() { @Override public void run() { String purchaseToken = "inapp:" + getPackageName() + ":android.test.purchased"; try { Log.d("","Running"); int response = mService.consumePurchase(3, getPackageName(), purchaseToken); if(response==0) { Log.d("Consumed","Consumed"); }else { Log.d("","No"+response); } }catch (RemoteException e) { Log.d("Errorr",""+e); } } }); t.start(); } }); 
0
source

Source: https://habr.com/ru/post/1487406/


All Articles