Search Unity

IAP iOS sandbox payment success but doesn't give payout

Discussion in 'Unity IAP' started by HappyAdmission, Jul 28, 2021.

Thread Status:
Not open for further replies.
  1. HappyAdmission

    HappyAdmission

    Joined:
    Aug 5, 2018
    Posts:
    5
    I'm having trouble getting IAP to work on iOS. It was working a long time ago, i'm not sure when it broke. I haven't been able to get any version of In-App Purchasing to work now. The current version I'm trying is 4.0.0 but I also tried 3.2.3 and 2.1.1. I'm using Unity version 2020.1.14f1

    Even with 3.x+ versions of IAP when I click the Update button in the IAP services window it installs a bunch of stuff in Assets/Plugins/UnityPurchasing. It doesn't create IAPProductCatalog.json, BillingMode.json, AppleTangle.cs, or GooglePlayTangle.cs though. So to resolve the errors after clicking Update I delete everything out of Assets/Plugins/UnityPurchasing. Errors go away and purchasing works in the editor. Then when I build to device and run on an iPhone I have the sandbox purchase go through (I get the "You're all set. your purchase was successful. [Environment: Sandbox] message) but then nothing happens instead of giving the purchased item.

    In my Apple portal all of my billing, banking, and tax info is up to date.

    Am I installing IAP wrong? Any insight would be greatly appreciated. log attached
     

    Attached Files:

    Last edited: Jul 28, 2021
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you edit your post please and add the logs as an attachment? It will be much easier to read, thanks. Also, you only install IAP from Package Manager, do not use the Services window nor click on any Import buttons. When the upgrade is complete, you should make sure to delete /Assets/Plugins/UnityPurchasing. Ensure to make a full project backup before doing any major upgrades.
     
  3. HappyAdmission

    HappyAdmission

    Joined:
    Aug 5, 2018
    Posts:
    5
    Thanks Jeff, my post has been updated with the log as an attachment.

    I made a new build with Assets/Plugins/UnityPurchasing folder deleted and I'm still having the same issue. I will stay away from the service window update button.

    Another thing that might be worth noting is that the sandbox account only lets me attempt purchasing each IAP once. After I get the message that the purchase worked in the sandbox environment the next time I click that same IAP button nothing happens. This happens even on consumable purchases that should be repeatable.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    How are you debugging? You don't want to test by only observing the behavior, you'll want to debug too. You might want to start with the Sample IAP Project here https://forum.unity.com/threads/sample-iap-project.529555/#post-6950270 and https://forum.unity.com/threads/tips-for-new-unity-users.701864/#post-5057741
     
  5. HappyAdmission

    HappyAdmission

    Joined:
    Aug 5, 2018
    Posts:
    5
    I'm debugging with the xcode output window which is where I got the log. I've been using that to step through trying to find where the error is.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The logs say that you have a Null Reference Exception in ProcessPurchase, you'll want to debug there. Also compare your code to the Sample IAP Project.
     
  7. meowstudios

    meowstudios

    Joined:
    Nov 30, 2016
    Posts:
    9
    @JeffDUnity3D I know this is a bit off topie but Could you please update Sample IAP Project with the new version 4.0 ? I have a problem with the change from "IGooglePlayStoreExtensions" to "IGooglePlayConfiguration" regarding the "?.SetDeferredPurchaseListener(OnPurchaseDeferred);"
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry no. It would be easier to describe your issue and any error you might be receiving and steps to reproduce.
     
    meowstudios likes this.
  9. meowstudios

    meowstudios

    Joined:
    Nov 30, 2016
    Posts:
    9
    I used to have something like:

    Code (CSharp):
    1. m_GoogleExtensions = extensions.GetExtension<IGooglePlayStoreExtensions>();
    2.        m_GoogleExtensions?.SetDeferredPurchaseListener(OnPurchaseDeferred);
    in my IAPManager but the Changelog in 4.0.0 says
    Changed: - `IGooglePlayStoreExtensions.SetDeferredPurchaseListener` to `IGooglePlayConfiguration.SetDeferredPurchaseListener`

    and naturally now I get an error at that line of code because of the change
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    In Package Manager for In App Purchasing 4.0.0, I would encourage you to Import the deferred purchase sample, it will demonstrate the updated code:

    Code (CSharp):
    1. var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    2. builder.Configure<IGooglePlayConfiguration>().SetDeferredPurchaseListener(OnDeferredPurchase);
     
    meowstudios likes this.
  11. 3la288_sh

    3la288_sh

    Joined:
    Sep 1, 2013
    Posts:
    11
    hello , so iam using the Unity IAP


    this working fine for android , but when i am trying to pass the ios apple review team , it always getting rejected with this error : "When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code "Sandbox receipt used in production," you should validate against the test environment instead."

    so i googled the validating receipt , but couldnt find what and where to add the right things .
    i already looked on this : https://docs.unity3d.com/Manual/UnityIAPValidatingReceipts.html

    but this wasnt clear enough to help me where i want to add those codes.
    can someone give the steps where to start?
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    This is a separate issue, typically you would want to start a new thread. However, this is a known limitation with Codeless IAP, it does not support receipt validation which is required by Apple. You will want to use Scripted IAP instead, perhaps start with the Sample IAP Project v2 here, or the shipping Samples with IAP 4.x https://forum.unity.com/threads/sample-iap-project.529555/#post-6950270
     
  13. BilalGuvenc

    BilalGuvenc

    Joined:
    May 5, 2020
    Posts:
    16
    for last line I get
    error CS1955: Non-invocable member 'IGooglePlayConfiguration' cannot be used like a method.

    Unity 2020.3.26f1
    IAP 4.1.2
     
    Last edited: Jan 21, 2022
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    This thread is discussing IAP on iOS. You are showing the Google (Android) code, just comment out that line. I believe you are missing the closing > character

    Code (CSharp):
    1. builder.Configure<IGooglePlayConfiguration>().SetDeferredPurchaseListener(OnDeferredPurchase);
     
    BilalGuvenc likes this.
  15. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    142
    Unity IAP implementation has become incomprehensible IMO.
     
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The API hasn't changed much, so I'm unsure what you are referring to. I have written the code for you, in the Sample IAP Project. We also have many great Samples that ship with the product, you can view them in Package Manager.
     
    Endahs and IndieFist like this.
  17. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    520
    I think there is an error in our example.
    Line 140
    Code (CSharp):
    1.  m_GoogleExtensions.SetDeferredPurchaseListener(OnPurchaseDeferred);
    I can do in builder:
    Code (CSharp):
    1. builder.Configure<IGooglePlayConfiguration>().SetDeferredPurchaseListener(OnPurchaseDeferred);
    But then i got error in line 140
     

    Attached Files:

  18. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please see the previous post in this thread, and the notes in the post for the Sample IAP Project v2:

    https://forum.unity.com/threads/iap...-but-doesnt-give-payout.1148126/#post-7382948

    https://forum.unity.com/threads/sample-iap-project.529555/#post-6950270

    And this thread is discussing iOS, you are posting a Google issue. I have purposely left the code as-is in the Sample IAP Project to motivate the user to understand the updated code. I will go ahead and lock this thread now. Ensure to be using IAP 4.1.3 (or higher)
     
Thread Status:
Not open for further replies.