Problem description: Flutter_inapp_purchase payment repository, error occurred when clicking to buy the managed item;
W/BillingClient(25436): Unable to buy item, Error response code: 7
E/DoobooUtils(25436): Error Code : 7
I/ Flutter (25436): [Price: 65.99, monthPrice: 5.50]
I/ Flutter (25436): [Price: 29.99, monthPrice: 10.00]
I/ Flutter (25436): [Price: 149.99, monthPrice:]
D/FA (25436): Logging Events (FE): HWPurchaseSelect, Bundle[{source=, ga_event_origin(_O)=app, ga_screen_class(_SC)=MainActivity, ga_screen_id(_SI)=-2672549720685398148, Purchase_month =lifetime}]
I/flutter (25436): kiit0611==== 3 responseCode: 7, debugMessage: Item is already owned., code: E_ALREADY_OWNED, message: You already own this item.
The error is obvious: you already have this item, indicating that the current account logged into Google Play has already purchased this item.
Solutions:
Change your Google Play account directly and clear the Google Account cache (clear the Google Play cache). To buy again, sometimes you need to restart the phone.
This problem usually occurs on the ios side, but if it does occur in Google, it can be solved according to the above method. However, it is important to note that when using the library, the code looks like this:
FlutterInappPurchase.instance.clearTransactionIOS();…
/// google order confirmation operation. /// If the purchase transaction is not confirmed within a further 3 days, the user will automatically receive a refund, along with // Google Play will revoke that purchase transaction if (Platform.isAndroid) { FlutterInappPurchase.instance .acknowledgePurchaseAndroid(productItem.purchaseToken); FlutterInappPurchase.instance .consumePurchaseAndroid(productItem.purchaseToken); }
The screenshot is as follows:
Please have such code. FlutterInappPurchase.instance .consumePurchaseAndroid(productItem.purchaseToken); That means consume it, or else it will always be there and report errorCode = 7.
The source code in the Flutter_inapp_Purchase payment repository is as follows: See the red comment.
/// Consumes a purchase on `Android`. /// /// No effect on `iOS`, whose consumable purchases are consumed at the time of purchase. /// /// if you already invoked [getProducts],you ought to invoked this method to confirm you have consumed. /// that means you can purchase one IAPItem more times, otherwise you'll receive error code : 7 /// /// in DoobooUtils.java error like this: /// case BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED: /// errorData[0] = E_ALREADY_OWNED; /// errorData[1] = "You already own this item."; /// break; Future<String> consumePurchaseAndroid(String token, { String developerPayload }) async { if (_platform.isAndroid) { String result = await _channel.invokeMethod('consumeProduct', <String, dynamic>{ 'token': token, 'developerPayload': developerPayload, }); return result; } else if (_platform.isIOS) { return 'no-ops in ios'; } throw PlatformException( code: _platform.operatingSystem, message: "platform not supported"); }
Keep in mind that google-enabled phones can sometimes get weird with lots of accounts and caches (clear the Goole Play cache), so it’s best to switch accounts, clear the cache, and restart the phone.
Read More:
- Google Play googleapi: Error 403: Google Play Android Developer API has not been used in project
- flutter | W/zipro(12512): Error opening archive D:\…Invalid file ERROR: dump failed because…
- Flutter Xcode Module not found or LibreSSL SSL_connect: SSL_ERROR_SYSCALL
- How to Solve Android Error: gps requires ACCESS_FINE_LOCATION
- [ubuntu14.04]Tensorflow: Could not find any downloads that satisfy the requirement
- vue VM682:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0
- The execution of ExecuteNonQuery by oraclecommand is suspended
- Cache penetration, cache breakdown and cache avalanche solutions
- JSON parse error: Can not deserialize instance of java.lang.String out of START_OBJECT token
- Runtime error prompt in Android Studio: arrayadapter requires the resource ID to be a textview problem
- Mac error: SH: Vue cli service: command not found
- (How to Fix) Ora-00600: internal error code, arguments: [4194]
- How to Solve Error “Could not find com.android.tools.build:gradle:3.0.1”
- No match for ‘operator =’ both ends of the equal sign do not match
- How to parse JSON string in.Net [error reading job object from jsonreader. Current jsonreader item is not an obj]
- Android studio version 3.0 import version 2.2.2 error Error:This Gradle plugin requires Studio 3.0 minimum
- Solution: configuration of multiple front ends separated from front end and back end of nginx
- Vue error in render: “typeerror: cannot read property ‘length’ of undefined”
- Error Report of Yarn Create UMI
- MyBatis: Mapped Statements collection does not contain value for xxx