In-App Purchase Subscription Offer Code Not Working Android

22 Views Asked by At

I am having issue with the subscription offer, other things works fine.

Code for loading products / query products.

ImmutableList<QueryProductDetailsParams.Product> productList = ImmutableList.of(
        //Product 1
        QueryProductDetailsParams.Product.newBuilder()
                .setProductId(BaseActivity.ONE_MONTH)
                .setProductType(BillingClient.ProductType.SUBS)
                .build(),
        //Product 2
        QueryProductDetailsParams.Product.newBuilder()
                .setProductId(BaseActivity.ONE_YEAR)
                .setProductType(BillingClient.ProductType.SUBS)
                .build()
);
QueryProductDetailsParams queryProductDetailsParams = QueryProductDetailsParams.newBuilder()
        .setProductList(productList)
        .build();

    billingClient.queryProductDetailsAsync(queryProductDetailsParams, new ProductDetailsResponseListener() {
        @Override
        public void onProductDetailsResponse(@NonNull BillingResult billingResult, @NonNull List<ProductDetails> list) {
          this.productDetailsList = list
        }
    });

Launch Flow

    ImmutableList<BillingFlowParams.ProductDetailsParams> productDetailsParamsList =
            ImmutableList.of(
                    BillingFlowParams.ProductDetailsParams.newBuilder()
                            .setProductDetails(productDetails)
                            .setOfferToken(productDetails.getSubscriptionOfferDetails().get(0).getOfferToken())
                            .build()
            );
    BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
            .setProductDetailsParamsList(productDetailsParamsList)
            .build();

    billingClient.launchBillingFlow(this, billingFlowParams);

Image : Playstore Subscription Offer

Image : ProductJSON Response in logs

But when press executing launch flow, i mean try to purchase that product / subscription. It should display the discounted price or discount details, not able to understand how its working, i am matching Crite area for offer, new user and never purchased this subscription.

enter image description here

0

There are 0 best solutions below