Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CatalogOffer.AvailableForPurchase always false coming #1115

Open
paulhazen opened this issue Feb 5, 2025 · 6 comments
Open

CatalogOffer.AvailableForPurchase always false coming #1115

paulhazen opened this issue Feb 5, 2025 · 6 comments
Assignees
Labels
assistance tracked This issue has a corresponding task in our internal bug tracking system

Comments

@paulhazen
Copy link
Collaborator

paulhazen commented Feb 5, 2025

Discussed in https://github.com/PlayEveryWare/eos_plugin_for_unity/discussions/1113

Originally posted by KaalirajanChennaiGames February 5, 2025
Used version: 3.3.3 & 3.3.5

  1. EOSManager.Instance.StartLoginWithLoginTypeAndToken() working fine. (Login)
  2. EOSManager.Instance.GetEOSEcomInterface().QueryOffers() working fine. (Get all IAP prodcucts/offers)
  3. EOSManager.Instance.GetEOSEcomInterface().GetOfferCount() working fine. (offer count: 11)
  4. EOSManager.Instance.GetEOSEcomInterface().Checkout() Not working fine.

Here CatalogOffers[index].AvailableForPurchase always false. why?
If I try to CheckOut(), the Result Code always "NotConfigured". why?

Note: Build was uploaded in Dev & Stag(but not submitted to review)

#EOS-2386

@paulhazen
Copy link
Collaborator Author

Hi @KaalirajanChennaiGames - I'm moving this from a discussion to being an issue.

@WispyMouse WispyMouse added the tracked This issue has a corresponding task in our internal bug tracking system label Feb 5, 2025
@WispyMouse
Copy link
Collaborator

Ahoy @KaalirajanChennaiGames ! I hope this message reaches you.

I'd like to have you configure some logging settings. Please:

  • In Player Settings, in Compiler Symbols, define ENABLE_DEBUG_EOSMANAGER
  • Use the "Log Level Config" window in the EOS Plugin to set "All Categories" to "Verbose"

Then repeat the error, and share your logs here.

Are you utilizing the EOSStoreManager class, or are you doing everything directly through the EcomInterface? What class holds the CatalogOffers array you're seeing as not being marked AvaialbleForPurchase?

@KaalirajanChennaiGames
Copy link

KaalirajanChennaiGames commented Feb 7, 2025

Hi, Yes directly using the EcomInterface. i.e here I attached logs and methods:

private void OnQueryOffers(ref QueryOffersCallbackInfo queryOffersCallbackInfo)
    {
        CatalogOffers.Clear();

        Debug.Log("==OnQueryOffers QueryOffers callback. ResultCode=" + queryOffersCallbackInfo.ResultCode);

        if (queryOffersCallbackInfo.ResultCode == Result.Success)
        {
            var getOfferCountOptions = new GetOfferCountOptions();
            getOfferCountOptions.LocalUserId = EOSManager.Instance.GetLocalUserId();

            var offerCount = EOSManager.Instance.GetEOSEcomInterface().GetOfferCount(ref getOfferCountOptions);

            Debug.Log("OnQueryOffers offerCount==========>" + offerCount);

            if(offerCount > 0)
            {
                for (int offerIndex = 0; offerIndex < offerCount; ++offerIndex)
                {
                    var copyOfferByIndexOptions = new CopyOfferByIndexOptions();
                    copyOfferByIndexOptions.LocalUserId = EOSManager.Instance.GetLocalUserId();
                    copyOfferByIndexOptions.OfferIndex = (uint)offerIndex;

                    var copyOfferByIndexResult = EOSManager.Instance.GetEOSEcomInterface().CopyOfferByIndex(ref copyOfferByIndexOptions, out var catalogOffer);
                    switch (copyOfferByIndexResult)
                    {
                        case Result.Success:
                        case Result.EcomCatalogOfferPriceInvalid:
                        case Result.EcomCatalogOfferStale:

                            Debug.Log("\n================================================="
                                 + "\nofferIndex:" + offerIndex
                                 + "\nServerIndex:" + catalogOffer?.ServerIndex
                                + "\ncatalogOffer.Id:" + catalogOffer?.Id
                                + "\ncatalogOffer.TitleText:" + catalogOffer?.TitleText
                                + "\ncatalogOffer.PriceResult:" + catalogOffer?.PriceResult
                                + "\nCurrentPriceAsString:" + GetCurrentPriceAsString(catalogOffer)
                                + "\nOriginalPriceAsString:" + GetOriginalPriceAsString(catalogOffer)
                                + "\nCatalogNamespace:" + catalogOffer?.CatalogNamespace
                                + "\nDescriptionText:" + catalogOffer?.DescriptionText
                                + "\nLongDescriptionText:" + catalogOffer?.LongDescriptionText
                                + "\nDiscountPercentage:" + catalogOffer?.DiscountPercentage
                                + "\nEffectiveDateTimestamp:" + catalogOffer?.EffectiveDateTimestamp
                                + "\nReleaseDateTimestamp:" + catalogOffer?.ReleaseDateTimestamp
                                + "\nPurchaseLimit:" + catalogOffer?.PurchaseLimit
                                + "\nDecimalPoint:" + catalogOffer?.DecimalPoint
                                + "\nCurrencyCode:" + catalogOffer?.CurrencyCode
                                + "\nAvailableForPurchase:" + catalogOffer?.AvailableForPurchase
                                 + "\n====================================================="
                                );

                            CatalogOffers.Add(catalogOffer.Value);
                            break;

                        default:
                            Debug.Log($"Offer {offerIndex} invalid: {copyOfferByIndexResult}");
                            break;
                    }
                }

                currencyCode = CatalogOffers[0].CurrencyCode;

                CheckOfferOwnership();
            }
            
            CatalogOffersDirty = true;
            GameManager.instance.gotStoreProductdetails = true;
        }
        else
        {
            Debug.LogError("Error calling QueryOffers: " + queryOffersCallbackInfo.ResultCode);
        }
    }
if (catalogOffer.AvailableForPurchase) //Here always false
{
      EpicGamesManager.instance.Checkout(catalogOffer); // product clicked
}
public void Checkout(CatalogOffer catalogOffer)
    {
        Debug.Log("======Checkout() called for ======" + catalogOffer.Id);
        CheckoutEntry checkoutEntry = new CheckoutEntry();
        checkoutEntry.OfferId = catalogOffer.Id;

        Debug.Log("\nOfferId=>" + checkoutEntry.OfferId);

        CheckoutOptions checkoutOptions = new CheckoutOptions();
        checkoutOptions.LocalUserId = EOSManager.Instance.GetLocalUserId();
        checkoutOptions.Entries = new CheckoutEntry[] { checkoutEntry };

        Debug.Log("checkoutOptions.LocalUserId=>" + checkoutOptions.LocalUserId);
        Debug.Log("checkoutEntry.OfferId=>" + checkoutEntry.OfferId);

        Dictionary<string, string> clientData = new Dictionary<string, string>();
        clientData.Add("OfferId", catalogOffer.Id);
        clientData.Add("TitleText", catalogOffer.TitleText);

        EOSManager.Instance.GetEOSEcomInterface().Checkout(ref checkoutOptions, clientData, OnCheckout);
        //==============Success Purchase Hardcode========
        //CheckoutCallbackInfo callbackInfo = new CheckoutCallbackInfo();
        //callbackInfo.ResultCode = Result.Success;
        //callbackInfo.ClientData = clientData;
        //callbackInfo.TransactionId = catalogOffer.Id;
        //OnCheckout(ref callbackInfo);
        //==============Failed Purchase Hardcode========
        //CheckoutCallbackInfo callbackInfo = new CheckoutCallbackInfo();
        //callbackInfo.ResultCode = Result.Canceled;
        //callbackInfo.ClientData = clientData;
        //callbackInfo.TransactionId = catalogOffer.Id;
        //OnCheckout(ref callbackInfo);
        //=================================================
    }




[issue_all_logs.txt](https://github.com/user-attachments/files/18701645/issue_all_logs.txt)

@WispyMouse
Copy link
Collaborator

Wild guessing, from Epic documentation here: https://dev.epicgames.com/docs/api-ref/structs/eos-ecom-catalog-offer

Purchase Limit: The maximum number of times that the offer can be purchased. A negative value implies there is no limit.

I noticed your Purchase Limit returned is 0. I think this needs to be a negative number if it's meant to be infinitely purchaseable, or 1 if it's meant to be purchased once. I do not know where in the UI this value is configured. Trying to dig in to that.

@WispyMouse
Copy link
Collaborator

Can you review the "Launch date" in the UI for one of your IAPs? You should have a view like this. I'm seeing your "effective date" is hilariously far in to the future, and I'm wondering if that's indicating that it cannot be purchased.

Image

@WispyMouse
Copy link
Collaborator

One more bit of advice. There's a switch statement handling Result.Success, EcomCatalogOfferPriceInvalid, and EcomCatalogOfferStale, inside the OnQueryOffers. Try printing out the Result code from this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assistance tracked This issue has a corresponding task in our internal bug tracking system
Projects
None yet
Development

No branches or pull requests

3 participants