jamesmontemagno / InAppBillingPlugin

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

James, I can't get Purchase Subscription to pick up my product id, #611

Open GenCodeInc opened 4 months ago

GenCodeInc commented 4 months ago

James, I can't get Purchase Subscription to pick up my product id I read this https://jamesmontemagno.github.io/InAppBillingPlugin/GetProductDetails.html and https://jamesmontemagno.github.io/InAppBillingPlugin/PurchaseSubscription.html

.NET 8

I can't get it to get the billing info- I get $"InAppBillingPurchaseException {pEx.Message}", "Ok");

invalid products found when querying the list.

it can't find it In settings/app store. I changed to and confirmed that I am using my sandbox id - I tried making a second sandbox id same issue (per the other doc) I tried deploying to the macbook and tesitng an adhoc there, and inside testflight. its the same ID as selected in section In-App Purchases and Subscriptions

Note this has never been in app store. I dont need to charge immediately, I guess I could deploy it now and see if it works there with a hidden test button and try to get my GetProductInfoAsync

But it should work in testflight or sandbox I think.

below is an example, it's not subscribing just trying to confirm it finds my products

    private async void SubscribeButton_Clicked(object sender, EventArgs e)
    {
        try
        {
            var billing = CrossInAppBilling.Current;
            try
            {

                var productIds = new string[] { "com........myproductid" };  // actual one used

                //You must connect
                var connected = await billing.ConnectAsync();

                if (!connected)
                {
                    await DisplayAlert("Error", 
                        "Can't connnect to billing, try again later?","Ok");
                    return;
                }

                //check purchases

                var items = await billing.GetProductInfoAsync(ItemType.InAppPurchase, productIds);

                foreach (var item in items)
                {
                    await DisplayAlert("Error",
                        $"Found product {item.ProductId}", "Ok");
                }
            }
            catch (InAppBillingPurchaseException pEx)
            {
                await DisplayAlert("Error",
                    $"InAppBillingPurchaseException {pEx.Message}", "Ok");
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error",
                    $"Ex 1 {ex.Message}", "Ok");
            }
            finally
            {
                await billing.DisconnectAsync();
            }
        }
        catch (Exception ex)
        {
            await DisplayAlert("Error",
                $"Ex 2 {ex.Message}", "Ok");
            Console.WriteLine($"Exception while subscribing: {ex.Message}");
        }
    }
hinnerkweiler commented 4 months ago

Seems you prefix the bundle ID. Could you try just "myproductid" not "com........myproductid"