无法消耗android.test.purchased sku,从BillingResult获取响应代码6

时间:2019-05-15 14:20:59

标签: android in-app-billing android-billing

我无法使用android.test.purchased产品ID。

下面是我处理采购的代码。

public void handlePurchase(Purchase purchase) {
    try {
        if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
            consumeSKU(purchase.getPurchaseToken(), purchase.getDeveloperPayload());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

下面是我的consumeSKU方法:

public void consumeSKU(String purchase_token, String developer_payload) {
    ConsumeParams consumeParams =
            ConsumeParams.newBuilder()
                    .setPurchaseToken(purchase_token)
                    .setDeveloperPayload(developer_payload)
                    .build();

    billingClient.consumeAsync(consumeParams, this);
}

和我的消费响应侦听器:

@Override
public void onConsumeResponse(BillingResult billingResult, String purchaseToken) {
    Toast.makeText(context, "onConsumeResponse: " + billingResult.getResponseCode() + ", purchase token: " + purchaseToken, Toast.LENGTH_LONG).show();
}

每次调用consumerSKU方法时,我都会从Response Code: 6获得billingResult

我要去哪里错了?

0 个答案:

没有答案