I have been testing the the new Google billing library release. The release notes state that "Purchases must be acknowledged within three days".
During testing, I noticed that if I don't acknowledge the purchase, within a few minutes, the purchase gets automatically refunded.
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?
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
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) -> {
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");
}
}
}
...and the acknowledgePurchases method
public void acknowledgePurchases(Purchase purchase, AcknowledgePurchaseResponseListener listener){
AcknowledgePurchaseParams params = AcknowledgePurchaseParams.newBuilder()
.setPurchaseToken(purchase.getPurchaseToken()).build();
billingClient.acknowledgePurchase(params, listener);
}
Indeed, from the Google Play Billing Library docs
For purchases made by license testers, the acknowledgement window is shorter. Instead of three days, purchases are refunded and revoked if they are not acknowledged within five minutes