In Flutter, how can I use a Google Play subscription offer which is developer determined? - Stack Overflow

I have a subscription enabled in Google Play for my Flutter app. I am trying to create an offer on one

I have a subscription enabled in Google Play for my Flutter app. I am trying to create an offer on one of my subscriptions and customize it so that I can decide who can use this offer. I am using the in_app_purchase package, but I can't find a way to fetch the offer details and show pricing with and without offer based on a criteria set by me.

.SubscriptionOfferDetails

From here, I can see that the google billing library has ProductDetails.SubscriptionOfferDetails, but in_app_purchase doesn't seem to have anything like that to fetch offers and conditionally show the pricing.

I tried to do this, and I imported these and found an object called SubscriptionOffersDetailsWrapper, but I can't seem to use it in a way I want.

import 'package:in_app_purchase_android/in_app_purchase_android.dart';
import 'package:in_app_purchase_android/billing_client_wrappers.dart';

final ProductDetailsResponse response =
        await _inAppPurchase.queryProductDetails(_kIds);
    if (response.error != null) {
      // Handle the error
    }

    if (response.productDetails.isEmpty) {
      print("why empty");
    }

    for(var x in response.productDetails){
      if(x is GooglePlayProductDetails){
        offer = SubscriptionOfferDetailsWrapper(basePlanId: basePlanId, offerTags: offerTags, offerIdToken: offerIdToken, pricingPhases: pricingPhases)
      }
    }

How can I conditionally show an offer in my Flutter app with a Google Play subscription? Let’s say I created an offer with my subscription that gives user 10% discount, but only those users who in my app have listed sports as their hobby. In the eligibility criteria of the offer, I have selected developer determined.

But how can I actually implement that in Flutter?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742288779a4415805.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信