Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Codeless IAP fail to initialise on live production app, works fine in editor and shows fake purchase

Discussion in 'Unity IAP' started by Brother_77, Jun 26, 2023.

  1. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    226
    As the title suggests

    a) Unity 2020.3.47(LTS) + IAP package 4.9.2 on Android fails in a live app in Google Playstore. (tested with monitor.bat)
    b) on another instance Unity 2021.3.27(LTS) + IAP package 4.9.2 on iOS submission rejected due to "Remove button" not doing anything. With this I have no error log yet, but still both do not work and are set up correctly following documentation.

    Can someone please look into this. Thank you.
     
  2. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    226
  3. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    226
    Anyone else experiencing this issue ? I ended up manually coding the IAP system, through sample scripts provided with IAP package. Can someone verify that Codeless IAP is broken ? In App Purchasing 4.9.3
     
  4. NickVas

    NickVas

    Joined:
    Jul 28, 2017
    Posts:
    9
    I've noticed, in live app (android), that my codeless iap (4.9.2) stoped showing up prices and (new) iap buttons stoped functioning... in 4.9.3 also. (Everything was OK, and I did not touched the IAP until...)
     
    Brother_77 likes this.
  5. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    226
    Yes the button does nothing when pressed, even though set up correctly following the Doc's
     
  6. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    226
  7. NickVas

    NickVas

    Joined:
    Jul 28, 2017
    Posts:
    9
    With this I've noticed that Event's fields on my IAP buttons became empty somehow... (same on IAP Listener gameObject too)

    Screenshot 2023-07-09 at 21.46.04.png

    So, I added methods back from my fulfilment script, with some adjustments to it, so they can appear in dropdown menu.

    Screenshot 2023-07-09 at 22.12.33.png

    Screenshot 2023-07-12 at 11.43.27.png

    My simplified (for the purpose of an example) fulfilment script:

    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using UnityEngine.Purchasing;
    4. using UnityEngine.Purchasing.Extension;
    5. using UnityEngine.UI;
    6.  
    7. public class IAP_Fulfilment : MonoBehaviour
    8. {
    9.     public string _failureReason;
    10.  
    11.     public void OnProductsFetched(Product product)
    12.     {
    13.         if (product.definition.id == "25_GEMS")
    14.         {
    15.             GameManager.instance.price_25 = product.metadata.localizedPriceString;
    16.         }
    17.     }
    18.  
    19.     public void GrantGems(Product product)
    20.     {
    21.         if (product.definition.id == gems25)
    22.         {
    23.             GameManager.instance.gems += 25;
    24.         }
    25.  
    26.         _gemsText.UpdateGemsText();
    27.         GameManager.instance.SaveGame();
    28.     }
    29.  
    30.     public void OnPurchaseFailed(Product product, PurchaseFailureDescription failureDescription)
    31.     {
    32.         if (product.definition.id == gems25)
    33.         {
    34.             _failureReason = "" + failureDescription;
    35.         }
    36.     }
    37.  
    38.  
    39.     // METHODS FOR IAP LISTENER EVENTS
    40.  
    41.     public void OnProductFetched(ProductCollection products)
    42.     {
    43.         Product product;
    44.  
    45.         product = products.WithID(gems25);
    46.         GameManager.instance.price_25 = product.metadata.localizedPriceString;
    47.     }
    48.  
    49.  
    50.     public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)
    51.     {
    52.         if (product.definition.id == gems25)
    53.         {
    54.             GameManager.instance.notes[7] = true;
    55.             _failureReason_1 = "" + failureReason;
    56.         }
    57.     }
    58. }
    I'm saving the product price to GameManager.instance cause my Shop "page" not appearing on the start of the game...so I pull those prices back from GameManager.instance, when user opens the Shop page...

    photo_2023-07-12 11.39.15.jpeg

    Not sure for 100% if this is the right way for Codeless IAP, cause I'm still new to gamedev... but that's worked for me.
     
    Last edited: Jul 12, 2023
  8. NickVas

    NickVas

    Joined:
    Jul 28, 2017
    Posts:
    9
    I have removed fulfilment methods from IAP buttons event's fields OnpurchaseComplete and OnPurchaseFailed - it caused to run this methods twice... (one call from the button and one call from the IAP Listener)
     
    Brother_77 likes this.
  9. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    226
    And this fixed it ?