Google Play Billing Library 2.0 Acknowledge Purchase Time Limit for Test Purchases
Google Play Billing Library 2.0 Acknowledge Purchase Time Limit for Test Purchases
我一直在测试新的 Google 计费库版本。发行说明指出 "Purchases must be acknowledged within three days".
在测试过程中,我注意到如果我不确认购买,几分钟后,购买的款项会自动退款。
Google 是否以不同方式对待测试订单,只允许几分钟而不是 3 天来确认订单,或者我错过了什么?
这是我用来确认购买的代码。 PurchaseHolder 是一个 class,它保存购买和 SKU 以及来自我的后端服务器的响应代码
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");
}
}
}
...以及 acknowledgePurchases 方法
public void acknowledgePurchases(Purchase purchase, AcknowledgePurchaseResponseListener listener){
AcknowledgePurchaseParams params = AcknowledgePurchaseParams.newBuilder()
.setPurchaseToken(purchase.getPurchaseToken()).build();
billingClient.acknowledgePurchase(params, listener);
}
从文档中我们可以看到测试购买在更短的时间范围内运行以帮助测试:https://developer.android.com/google/play/billing/billing_testing#testing-renewals
如果一周的订阅在 5 分钟内续订,我想在开发过程中 3 天的购买确认限制将减少到几分钟。
的确,来自 Google Play Billing Library 文档
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
我一直在测试新的 Google 计费库版本。发行说明指出 "Purchases must be acknowledged within three days".
在测试过程中,我注意到如果我不确认购买,几分钟后,购买的款项会自动退款。
Google 是否以不同方式对待测试订单,只允许几分钟而不是 3 天来确认订单,或者我错过了什么?
这是我用来确认购买的代码。 PurchaseHolder 是一个 class,它保存购买和 SKU 以及来自我的后端服务器的响应代码
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");
}
}
}
...以及 acknowledgePurchases 方法
public void acknowledgePurchases(Purchase purchase, AcknowledgePurchaseResponseListener listener){
AcknowledgePurchaseParams params = AcknowledgePurchaseParams.newBuilder()
.setPurchaseToken(purchase.getPurchaseToken()).build();
billingClient.acknowledgePurchase(params, listener);
}
从文档中我们可以看到测试购买在更短的时间范围内运行以帮助测试:https://developer.android.com/google/play/billing/billing_testing#testing-renewals
如果一周的订阅在 5 分钟内续订,我想在开发过程中 3 天的购买确认限制将减少到几分钟。
的确,来自 Google Play Billing Library 文档
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