completePurchaseInPay method

Future completePurchaseInPay(
  1. PurchaseDetails? purchaseDetail
)

Implementation

Future completePurchaseInPay(PurchaseDetails? purchaseDetail) async {
  try {
    if (Platform.isAndroid) {
      InAppPurchaseAndroidPlatformAddition androidAddition = InAppPurchase
          .instance
          .getPlatformAddition<InAppPurchaseAndroidPlatformAddition>();
      BillingResultWrapper billingResult =
          await androidAddition.consumePurchase(purchaseDetail!);
      AppConfig.printLog('completePurchase: ${billingResult.responseCode}');
    } else if (purchaseDetail?.pendingCompletePurchase == true) {
      await connection.completePurchase(purchaseDetail!);
      AppConfig.printLog('completePurchase: checkInPayPurchase');
    } else {
      paymentQueueWrapper(payId: purchaseDetail?.productID, delayed: false);
    }
  } catch (e) {
    AppConfig.printLog(e);
  }
}