Hello,

I have been using InApp Purchases in my android app. So far every purchase 
went fine. 

I have problem regarding purchase refunds. I have done a real purchase of 
an InApp Product of my app. The purchase was succesful and I got the ORDER 
details at merchant page.
Since the purchase is for my test, I wanted to refund the money back, so I 
have cancelled the Order from the merchant page. The Order status changed 
to Refunded in merchant page.

Since the Order is refunded I want to disable/block the feature.


According to the developer page
 
https://developer.android.com/google/play/billing/billing_reference.html#purchase-data-table
 
<https://developer.android.com/google/play/billing/billing_reference.html#purchase-data-table>
 I 
got some info

purchaseState The purchase state of the order. Possible values are 0
 (purchased), 1 (canceled), or 2 (refunded).
So I thought when I query the google using 
getPurchases()
I will get the purchase bundle where the purchaseState will be 2.

I am condidering purchaseState to fighure out whether the fieature is 
purchased or not as shown in the code below.

But the console log always showing me Purchase state: 0

private QueryInventoryFinishedListener mGotInventoryListener  = new 
IabHelper.QueryInventoryFinishedListener() {
 public void onQueryInventoryFinished(IabResult result, Inventory inventory) 
{          
              
 
 logDebug("Query inventory finished."+ inventory);


 // Is it a failure?
 if (result.isFailure()) {
 Log.e(TAG, "Failed to query inventory: " + result.getResultMessage());
 return;
 }
 logDebug("Query inventory was successful");


 Purchase purchase = inventory.getPurchase("feature");
 logDebug("Purchase state: " + purchase.getPurchaseState());
 if ((purchase != null) && (purchase.getPurchaseState() == 0)) {
 // Enable feature in app
 } else {
 // Disable feature in app
 }


}



My question is once a refund happens How a developer should validate the 
feature purchase state in code to block the feature?


Please help on it.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/0835e929-5126-4860-8ea1-95345bf228ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to