我在用翩翩 应用内购买 插件。v0.3.3+1
.
在iOS上测试时,我开始购买,但中途取消了。此后,每当我再次尝试购买时,都会收到一条异常信息。
有一个待处理的交易 对于相同的产品标识符。
我在购买流上设置了一个监听器(代码如下)来完成购买。但是流没有发出任何事件。
_purchaseListener = InAppPurchaseConnection.instance.purchaseUpdatedStream.listen((purchases) {
purchases.forEach((purchase) async {
if (purchase.status == PurchaseStatus.purchased) //...
if (purchase.pendingCompletePurchase) {
//Complete purchase (retrying as Google Play refunds after 3 days if this does not succeed)
retry<BillingResultWrapper>(() async {
final completion = await InAppPurchaseConnection.instance.completePurchase(purchase);
const errors = {BillingResponse.error, BillingResponse.serviceUnavailable};
if (errors.contains(completion.responseCode)) throw Exception();
return completion;
});
}
});
});
该流没有发出任何事件,在 debug
模式,所以购买一直没有通过,正在完成。
测试中 release
模式,它可以完美地工作。