jamesmontemagno / InAppBillingPlugin

Cross-platform In App Billing Plugin for .NET
MIT License
651 stars 152 forks source link

Unable to fetch inapp products for Xamarin Android using Plugin.InAppBilling package #338

Closed assassin316 closed 3 years ago

assassin316 commented 3 years ago

Hi,

I've entered an issue in StackOverflow and also wanted to post here for visibility purposes. For some reason I never get my in-app products from my Play Console account. I've entered more details here:

https://stackoverflow.com/questions/65332635/unable-to-fetch-inapp-products-for-xamarin-android-using-plugin-inappbilling-pac/65358616#65358616

jamesmontemagno commented 3 years ago

Hmmm which version of the plugin are you using?

assassin316 commented 3 years ago

@jamesmontemagno 4.0.1.-beta

jamesmontemagno commented 3 years ago

Hmmmm, the code looks correct on my end..

var skuDetailsParams = SkuDetailsParams.NewBuilder()
                .SetType(skuType)
                .SetSkusList(productIds)
                .Build();

var skuDetailsResult = await BillingClient.QuerySkuDetailsAsync(skuDetailsParams);

Are your IAP active and are you in alpha/beta track?

assassin316 commented 3 years ago

I agree, I think the fault is not in your code, but rather something missing on my end. My IAP's are published and active and my app is published to Internal Testing (they got rid of the Alpha/Beta concept). I'll keep investigating and read up on some more docs to see if I missed something. I'll keep this issue up to date.

jamesmontemagno commented 3 years ago

I am pretty sure you need to do "closed testing" image

assassin316 commented 3 years ago

@jamesmontemagno ok I will try that out and report back with my results. Thanks for your time and input. It's a great library.

ish-1313 commented 3 years ago

seems to hit the same. in google docs stated that you may upload to any track including internal . so do i . inapps functionality appeared in google play console. but getproductinfoasync returns null till i found this thread, (only) uploaded binaries to closed track .. and occasionally getproductinfoasync starts working.
using ver 2.0.0

thank you

assassin316 commented 3 years ago

This was the fix. I pushed my app to Closed Testing (Alpha) and I received my in-app products. 👍 Thanks @jamesmontemagno !!

I'll keep an eye out for what @ish-1313 mentioned and see if I get the same behavior.

blmiles commented 3 years ago

SOrry to reopen this.

I'm trying to use the GetProductInfoAsync(0 method. Got the latest great stable version 4.0.2 installed in Xamarin Forms solution in each proj.

Create a simple method in my billing service:

    public async Task<string> GetLocalizedPrice(string prodId)
    {
        var billing = CrossInAppBilling.Current;
        try
        {
            var connected = await billing.ConnectAsync(true);

            string[] prodIds = new string[] { prodId };
            var productfound = await billing.GetProductInfoAsync(ItemType.Subscription, prodIds);
            InAppBillingProduct product = productfound.First();

            return product.LocalizedPrice;
        }
        catch
        {
            return string.Empty;
        }
    }

All other functionality works well. I can check and restore purchases and make a purchase. Need to retrieve InAppBillingProduct info as I have different non-std pricing for different countries.

When the GetProductInfoAsync() method is called, the service just hangs, nothing else happens. Never goes further.

And yes, checked prodIDs etc. I'm only passing in one at a time.

This is targeting the Apple App Store. Not got to the PlayStore just yet.

Any guidance?

Thanks