1

I am using in-app purchase in my android app. Procedure is all done when i try to purchase it asks me to add a debit or credit card to purchase that item. I want to know that can I somehow purchase that item with test credit or debit card just to complete the buying procedure.

Secondly in which listener i should actually allow to access the purchased item to user?

1- OnIabPurchaseFinishedListener
2- QueryInventoryFinishedListener
3- OnConsumeFinishedListener

or

4- onActivityResult

I am new to in-app purchase. Please suggest the right way.

Ali
  • 835
  • 1
  • 10
  • 23

1 Answers1

0

As far as I know you really need an active Google Wallet account in order to test your In-App purchase even if it's just a test-order.

Considering the "access to the purchased item". You should use the OnIabPurchaseFinishedListener method since this will only be called if the user successfully bought the item. The QueryInventoryFinishedListener method should be used if you're trying to restore a purchase.
And always check for the SKU of the different IAB-Items:

Example (OnIabPurchaseFinishedListener):

if(purchaseInfo.getSku().equals("MY_SKU")){
  ...
}

Example (QueryInventoryFinishedListener):

if(inventory.hasPurchase("MY_SKU")){
  ...
}
reVerse
  • 35,075
  • 22
  • 89
  • 84