createSubscriptionPlan method

  1. @override
Future<BasePurchaseModel> createSubscriptionPlan({
  1. required PurchaseDetails purchasedProduct,
  2. String? currencySymbol,
  3. String? price,
})
override

Implementation

@override
Future<BasePurchaseModel> createSubscriptionPlan(
    {required PurchaseDetails purchasedProduct,
    String? currencySymbol,
    String? price}) async {
  final String packageName = await DeviceInfoHelper.packageName;

  if (DeviceInfoHelper.isIos) {
    return IosPurchaseModel(
        currencySymbol: currencySymbol,
        price: price,
        receipt: purchasedProduct.verificationData.serverVerificationData);
  }
  return AndroidPurchaseModel(
    currencySymbol: currencySymbol,
    price: price,
    data: AndroidData(
      packageName: packageName,
      subscriptionId: purchasedProduct.productID,
      token: purchasedProduct.verificationData.serverVerificationData,
    ),
  );
}