title: How to handle Purchase States with Purchase History Record in new Google In App Purchase
body: <p>I am trying to create a restore purchase system. I want, the user can reach its bought products whichever device he/she logged in. So I use "queryPurchaseHistoryAsync()" method when app launches. My problem starts here.</p>
  
  <p>With new implementation of Google, On contrary to the documentation,  queryPurchaseHistoryAsync() parameters changed. Now it takes list of PurchaseHistoryRecord objects as parameter instead of list of Purchase objects. </p>
  
  <p>Android studio can not resolve the method stated in the documentation. With new queryPurchaseHistoryAsync() I couldn't find anyway to check purchases state.( if it is purchased, canceled or  pending). That I was able to do with Purchase object with "purchase.getPurchaseState()" method.</p>
  
  <p>Documentation of queryPurchaseHistoryAsync() </p>
  
  <pre><code>billingClient.queryPurchaseHistoryAsync(SkuType.INAPP,
                                           new PurchaseHistoryResponseListener() {
      @Override
      public void onPurchaseHistoryResponse(BillingResult billingResult,
                                            List&lt;Purchase&gt; purchasesList) {
          if (billingResult.getResponseCode() == BillingResponse.OK
                  &amp;&amp; purchasesList != null) {
              for (Purchase purchase : purchasesList) {
                  // Process the result.
              }
           }
      }
  });
  </code></pre>
  
  <p>My implementation</p>
  
  <pre><code>implementation 'com.android.billingclient:billing:2.0.3'
  </code></pre>
  
  <p>queryPurchaseHistoryAsync() Method in my app</p>
  
  <pre><code>billingClient.queryPurchaseHistoryAsync(BillingClient.SkuType.INAPP,
                  new PurchaseHistoryResponseListener() {
                      @Override
                      public void onPurchaseHistoryResponse(BillingResult billingResult, List&lt;PurchaseHistoryRecord&gt; purchaseHistoryRecordList) {
  
                          if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK
                                  &amp;&amp; purchaseHistoryRecordList != null) {
  
                              for (PurchaseHistoryRecord purchaseHistoryRecord : purchaseHistoryRecordList) {
  
                                  HandleOldGetting(purchaseHistoryRecord.getSku());
                               }
                          }
                      }
  </code></pre>
  
  <p>Release Note of Google(05-2019): </p>
  
  <p>"To minimize confusion, queryPurchaseHistoryAsync() now returns a
  PurchaseHistoryRecord object instead of a Purchase object. The PurchaseHistoryRecord object is the same as a Purchase object, except that it reflects only the values returned by queryPurchaseHistoryAsync() and does not contain the autoRenewing, orderId, and packageName fields. Note that nothing has changed with the returned data—queryPurchaseHistoryAsync() returns the same data as before." </p>
  
  <p>But neither release note nor documentation state how to check Purchase State with PurchaseHistoryRecord.</p>
  
  <p>Thank you for reading this, any help is appreciated.</p>