2

I am just getting started with Google Play In-App purchases. I want to get everything working with Google Play's static responses before creating test products.

I know that I can test making purchases using their reserved product IDs, such as android.test.purchased.

But, the next step is verifying the user's past purchases, using GetPurchases(). How can I test that using static responses?

If I "purchase" the "android.test.purchased" product, then later call GetPurchases(), will it return that item?

  • If not, what is the correct way to get a static response from GetPurchases() that returns a result showing that a product is indeed purchased?

  • If so, what do I need to do to "reset" it, so that it shows the special reserved product as unpurchased later for subsequent tests?

JoeMjr2
  • 3,804
  • 4
  • 34
  • 62
  • Create a test purchase, using test users id. Use same ID to getpurchases(). https://developer.android.com/google/play/billing/billing_testing.html – Amod Gokhale Dec 21 '16 at 02:17
  • @AmodGokhale, I had already read the page that you linked to, but under "Testing with Static Responses", it doesn't mention anything about GetPurchases(). Can you verify that you have tried what you said, and it that it returns a result stating that a Reserved product like android.text.purchased has actually been purchased? – JoeMjr2 Dec 21 '16 at 04:49
  • yes verified with test ID's in alpha/beta as well as in production – Amod Gokhale Dec 21 '16 at 06:37
  • Thanks, that worked. What about the second part of my question? Is there a way to "return" it, so that it no longer shows as purchased? – JoeMjr2 Dec 22 '16 at 01:21
  • goto your merchant section - select the payment with test order and intitiate refund. – Amod Gokhale Dec 22 '16 at 06:36
  • Ok, I had a developer account, but not a merchant account yet when I placed the order. I created a merchant account, but it says, "No orders have been placed yet". The order of the test item (android.test.purchased) still shows as purchased for me. Not sure how I can cancel it, since it doesn't show up in my merchant account. – JoeMjr2 Dec 22 '16 at 19:04
  • looks like solution i provided to give refund is not available now as its changed in google console. Please try solutions provided in this link http://stackoverflow.com/questions/38835452/how-to-cancel-an-in-app-test-purchase-on-android – Amod Gokhale Dec 23 '16 at 05:12
  • @AmodGokhale, Thanks for all the info. If you submit it as an answer, I will accept it. – JoeMjr2 Jan 05 '17 at 02:46

1 Answers1

-1

If I "purchase" the "android.test.purchased" product, then later call GetPurchases(), will it return that item?

  • If not, what is the correct way to get a static response from GetPurchases() that returns a result showing that a product is indeed purchased?

->Create a test purchase, using test users id. Use same ID to getpurchases().https://developer.android.com/google/play/billing/billing_testing.html

  • If so, what do I need to do to "reset" it, so that it shows the special reserved product as unpurchased later for subsequent tests?

->Goto your merchant section - select the payment with test order and initiate refund.(This is true prior to June 20, 2016 )

Starting June 20, 2016, one-time IAPs do not generate official order IDs (if at all) and will not appear in the Merchant Center. This behavior already applies to subscription IAPs. You can learn more about testing in-app billing in the Android Developers Help Center: https://developer.android.com/google/play/billing/billing_testing.html#testing-purchases

Amod Gokhale
  • 2,346
  • 4
  • 17
  • 32