admin管理员组

文章数量:1122846

So I have 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 in_app_purchase package but I can't find any 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 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, I imported these and found an object called SubscriptionOffersDetailsWrapper but can't seem to use it in any 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)
      }
    }

So I guess my question is that how can I conditionally show an offer in my flutter app with google play subscription. lets 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 eligibility criteria of the offer I have selected developer determined.

But how to actually implement that in flutter.

本文标签: In flutter how to use google play subscription offer which is developer determinedStack Overflow