consumePurchaseAndroid method

Future<String?> consumePurchaseAndroid(
  1. String token
)

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: errorData0 = E_ALREADY_OWNED; errorData1 = "You already own this item."; break;

Implementation

Future<String?> consumePurchaseAndroid(String token) async {
  if (_platform.isAndroid) {
    return await _channel.invokeMethod('consumeProduct', <String, dynamic>{
      'token': token,
    });
  } else if (_platform.isIOS) {
    return 'no-ops in ios';
  }
  throw PlatformException(
      code: _platform.operatingSystem, message: "platform not supported");
}