IAP iOS sandbox payment success but doesn't give payout

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

7369082–898292–unity_log.txt (62.1 KB)

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.

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.

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://discussions.unity.com/t/700293/3 and https://discussions.unity.com/t/748729/14

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.

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.

@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);”

Sorry no. It would be easier to describe your issue and any error you might be receiving and steps to reproduce.

1 Like

I used to have something like:

m_GoogleExtensions = extensions.GetExtension<IGooglePlayStoreExtensions>();
       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

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:

var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.Configure<IGooglePlayConfiguration>().SetDeferredPurchaseListener(OnDeferredPurchase);
1 Like

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 : Unity - Manual: Receipt validation

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

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://discussions.unity.com/t/700293/3

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

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

builder.Configure<IGooglePlayConfiguration>().SetDeferredPurchaseListener(OnDeferredPurchase);
1 Like

Unity IAP implementation has become incomprehensible IMO.

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.

2 Likes

I think there is an error in our example.
Line 140

 m_GoogleExtensions.SetDeferredPurchaseListener(OnPurchaseDeferred);

I can do in builder:

builder.Configure<IGooglePlayConfiguration>().SetDeferredPurchaseListener(OnPurchaseDeferred);

But then i got error in line 140

7894654--1005334--Captura de pantalla 2022-02-14 a las 10.05.56.png

Please see the previous post in this thread, and the notes in the post for the Sample IAP Project v2:

https://discussions.unity.com/t/850100/10

https://discussions.unity.com/t/700293/3

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)