flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.17k stars 27.49k forks source link

BillingResponse.developerError and Invalid sku type Error Android #149402

Closed cnkygmr closed 5 months ago

cnkygmr commented 5 months ago

Steps to reproduce

Active in app purchase example https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase/example

Expected results

According to the new version, sku type is not included in the subscription

Actual results

BillingClient: Error consuming purchase with token. Response code: 5 source: google_play message: BillingResponse.developerError details: Invalid sku type. code: consume_purchase_failed

Code sample

Active in app purchase example https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase/example

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

Logs

Logs ```console [Paste your logs here] ```

Flutter Doctor output

Doctor output ```console [Paste your output here] ```
darshankawar commented 5 months ago

@cnkygmr Can you provide us complete error log ? Also, is it replicable by running locally in debug mode ?

cnkygmr commented 5 months ago

@darshankawar

There is no error, the problem is that the in_app_purchase library is not suitable for the new version. queryPurchasesAsync() does not return this. The type of SKU, either "inapp" or "subs" as in SkuType. In the latest version, there is no this selection in the in_app_purchase library and it goes as inapp, but it gives an error because it is a subscription.

cnkygmr commented 5 months ago

@darshankawar

queryPurchasesAsync() is not have offlical example still have old queryProductDetails()

darshankawar commented 5 months ago

@cnkygmr Can you check this and see if it helps in your case or not ?

cnkygmr commented 5 months ago

@darshankawar

Nope, i need GooglePlayProductDetails for productType but standart example has ProductDetails when i use queryProductDetails().

So ProductDetails not have productType.

cnkygmr commented 5 months ago

@darshankawar

What I want to know is what should I do with the current official example? Invalid SKU type. To avoid getting the error?

cnkygmr commented 5 months ago

@darshankawar

I tried such a way, but it still gave the same error.

purchaseParam = GooglePlayPurchaseParam(
       productDetails: productDetails as GooglePlayProductDetails,  // like that
);
cnkygmr commented 5 months ago

@darshankawar

I made a ridiculous mistake, I used buyConsumable for subscription.

darshankawar commented 5 months ago

Does that mean the reported behavior isn't a bug in plugin ?

github-actions[bot] commented 4 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.