title: Google Play Billing Library 2.0 Acknowledge Purchase Time Limit for Test Purchases
body: <p>I have been testing the the new Google billing library release.  The release notes state that "Purchases must be acknowledged within three days".</p>
  
  <p><a href="https://developer.android.com/google/play/billing/billing_library_releases_notes" rel="nofollow noreferrer">Release notes</a></p>
  
  <p>During testing, I noticed that if I don't acknowledge the purchase, within a few minutes, the purchase gets automatically refunded.</p>
  
  <p>Is it the case that Google treats test orders differently and only allows a few minutes to acknowledge an order as opposed to 3 days or am I missing something? </p>
  
  <p>Here is the code I am using to acknowledge the purchase.  PurchaseHolder is a class that holds the purchase and SKU along with a response code from my back end server</p>
  
  <pre><code>for (IABManager.PurchaseHolder pm : purchaseHolders){
      if(pm.getSku().equals(SKU)) {//found matching SKU
          if (pm.getActionResult() == IABManager.BillingActionResult.VALID_PURCHASE) {//valid purchase made
              if(!pm.getPurchase().isAcknowledged()) {//purchase not yet acknowledged
                  iabManager.acknowledgePurchases(pm.getPurchase(), (billingResult) -&gt; {
                      Log.d(TAG, "AcknowledgedPurchaseResponse received from Google");
                      if(billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
                          unlockFeatures();
                      }
                  });
              }else{
                  unlockFeatures();
              }
  
          } else if (pm.getActionResult() == IABManager.BillingActionResult.NON_VALID_PURCHASE){
              lockFeatures();
          }else{
              Log.d(TAG, "BILLING_ACTION_RESULT = " + pm.getActionResult() + " doing nothing");
          }
      }
  }
  </code></pre>
  
  <p>...and the acknowledgePurchases method</p>
  
  <pre><code>public void acknowledgePurchases(Purchase purchase, AcknowledgePurchaseResponseListener listener){
  
      AcknowledgePurchaseParams params = AcknowledgePurchaseParams.newBuilder()
              .setPurchaseToken(purchase.getPurchaseToken()).build();
  
      billingClient.acknowledgePurchase(params, listener);
  }
  </code></pre>