title: Android in-app billing - How to handle refunds
body: <p>I am trying to implement in-app billing in my app, everything works great except for when it comes to refunds. I have been banging my head against this for the past few days and it seems unbelievable that there is no way to know, form the app side, if a user requested a refund.
  I would like to be able to revoke access to a one-time managed product (remove ads) after the user has been refunded.
  I am not using a backend so I am relying on Google Play APIs.</p>
  
  <p>What I have tried is querying the Google Play APIs with <code>queryPurchaseHistoryAsync</code> which returns a list of recent purchases made by the user. This does not seem to work as the purchases are still there after asking for a refund (been waiting for one day before writing this).</p>
  
  <p>Here's what I did:</p>
  
  <ol>
  <li>Install the app on a real device</li>
  <li>Buy the in-app content</li>
  <li>Verify that app unlocks the content</li>
  <li>Go to my Google Play order history and ask for refund for the in-app product</li>
  <li>10 minutes later the transaction got refunded (without me as a developer being involved at all)</li>
  <li>App still provides the paid content</li>
  <li>Cleaning Play Store App data &amp; cache</li>
  <li>App still provides the paid content</li>
  </ol>
  
  <p>So any user can buy my in-app product and then immediately go to his Google Play page and ask for a refund?
  Is it me missing something obvious or this API is a nightmare?</p>
  
  <p>The <code>PurchaseState</code> enum is</p>
  
  <pre><code>  public @interface PurchaseState {
      // Purchase with unknown state.
      int UNSPECIFIED_STATE = 0;
      // Purchase is completed.
      int PURCHASED = 1;
      // Purchase is waiting for payment completion.
      int PENDING = 2;
    }
  </code></pre>
  
  <p>I do not see anything related to refunded here,
  This seems to me a pretty normal use case, so I'm still thinking that I am missing some key piece of information, how do I do this?</p>
  
  <p>Thanks for any help</p>