[英]Updating google play billing library to version 2 is not working, purchase is always refunded
I had a functioning Android implementation in-app billing, using the billing client 1.0.2 library and everything worked fine.我有一个正常运行的 Android 实现应用内计费,使用计费客户端 1.0.2 库,一切正常。 I have a simple premium upgrade, without subscriptions.
我有一个简单的高级升级,没有订阅。
Now I tried to upgrade to 2.0.3, I made all the necessary changes to my code (using official documentation, release notes, and StackOverflow) and it doesn't work.现在我尝试升级到 2.0.3,我对我的代码进行了所有必要的更改(使用官方文档、发行说明和 StackOverflow)但它不起作用。 I know I must recognize all purchases within three days.
我知道我必须在三天内确认所有购买。 Failure to correctly recognize purchases will result in reimbursement for these purchases.
未能正确识别购买将导致这些购买的报销。 And that's what I did.
这就是我所做的。
The entire purchase workflow looks okay, the behavior is like before the library is updated.整个购买工作流程看起来不错,行为就像库更新之前一样。 But in the end my purchase is always refunded after 5 minutes (using a trial account, so it's 5 minutes instead of 3 days).
但最后我的购买总是在 5 分钟后退款(使用试用帐户,所以是 5 分钟而不是 3 天)。
this is inside onPurchasesUpdated:这是在 onPurchasesUpdated 里面:
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
if (!purchase.isAcknowledged()) {
AcknowledgePurchaseParams acknowledgePurchaseParams = AcknowledgePurchaseParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build();
AcknowledgePurchaseResponseListener acknowledgePurchaseResponseListener = new AcknowledgePurchaseResponseListener() {
@Override
public void onAcknowledgePurchaseResponse(BillingResult billingResult) {
Toast.makeText(getContext(), "Purchase acknowledged", Toast.LENGTH_LONG);
}
};
mBillingClient.acknowledgePurchase(acknowledgePurchaseParams, acknowledgePurchaseResponseListener);
}
}
The debugger performs recognition and in onAcknowledgePurchaseResponse, I can see that my billingResult response code is 5 (developer error), the debug message is empty.调试器执行识别,在 onAcknowledgePurchaseResponse 中,我可以看到我的 billingResult 响应代码为 5(开发人员错误),调试消息为空。 And I have no idea what's wrong.
而且我不知道出了什么问题。 Please, someone can help me find out what's missing.
拜托,有人可以帮我找出缺少的东西。 Many thanks!
非常感谢!
After updating the billing client library to 3.0.0 everything works fine!将计费客户端库更新到 3.0.0 后一切正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.