UnityIAP: Finishing transaction XXXXXXXXXXXX

Hi,

I was testing another IAP plugins (not related to Unity) on my iPhone X (iOS 15) and makes me had errors when paying, so this cause that now I have a tons of pending transactions every time I initialize this Unity IAP plugin. Also I can just Initialize well this Unity IAP Plugin when I shutdown and on again my iPhone, so it initialize well just once every time I restart the iPhone, other times I start the app, the plugin does not initialize well. I want to know if there is some event to catch that Pending transactions to finish them manually. I read something about ProcessPurchase being fired when there are finish transaction but not my case.

I tested this Unity IAP Plugin on other device with same Apple ID account and works well.

Many Thanks!!

Yes, if the transaction is still in Pending, you should expect ProcessPurchase to trigger when you initialize IAP through script. If not, then it might be an issue with the transaction from the other product. How do you know you have “tons of pending transactions”? Where do they show up with Unity IAP?

Yes, I have a pending transactions from 4 products at least. I have added them all to the IAP catalog and when initializing the IAPManager.

This is what I see from Unity IAP plugin logs when I start the app:

[This is when the app starts but not the initializer script]

UnityIAP UnityEarlyTransactionObserver: Created
UnityIAP UnityEarlyTransactionObserver: Registered for lifecycle events
UnityIAP UnityEarlyTransactionObserver: Added to the payment queue
Event dropped. Reason: Subscription purchase is a duplicate. Product ID: xxx
Event dropped. Reason: Subscription purchase is a duplicate. Product ID: xxx2
Event dropped. Reason: Subscription purchase is a duplicate. Product ID: xxx3

Tons of “Event dropped. Reason: Subscription purchase is a duplicate. Product ID: xxx” from 4 different products of the app

[This is when the script initialize]

UnityIAP: Requesting 5 products...
UnityIAP: Received 5 products
OnInitialized: PASS
UnityIAP: Add transaction observer
UnityIAP: UpdatedTransactions
UnityIAP UnityEarlyTransactionObserver: Request to initiate queued payments
UnityIAP: Finishing transaction xxx
UnityIAP: Finishing transaction xxx
UnityIAP: Finishing transaction xxx

Tons of “UnityIAP: Finishing transaction” there.

So, this just happen once when I restart the phone and open the app. If I close the app and open again it stucks on “UnityIAP: Requesting 5 products…”.

One question here: If I use the script initializer, do I need to fill the IAP Catalog with the products or just in the script when initializing?

I don’t receive any ProcessPurchase event when transaction pending appears on the logs

Many thanks.

@ArnauKokoro You mention “the IAP catalog and when initializing the IAPManager”, are you using IAP Buttons (Codeless)? It sounds like you might be mixing Codeless with Scripted IAP. You should not be using the IAP Catalog if you’re also writing IAP script. That would explain the missing ProceessPurchase calls (because Codeless also tries to initialize IAP) You might want to compare to the Sample IAP Project v2 here for an example of using Scripted IAP and using ProcessPurchase Sample IAP Project

Yes, I had Codeless Buttons before, but now I want to use the script. So I unchecked the Automatically Initialize option on the IAP Catalog. I thought this was enough to not use Codeless initializing, I don’t have IAP Codeless Buttons either.

What else should I do to remove Codeless?

Other question is, what means:
Event dropped. Reason: Subscription purchase is a duplicate. Product ID: xxxx. ??

I’m testing with Sample v2 and when Initializing my products just have id, so no transactionID, no receipt…Is that right?

I have the script on the main scene and ProcessPurchase is not called and I still have transactions pending.

I think when it says “Finishing transaction xxxxxxx” it never finish the transaction. Otherwise that xxxxxx each time are different…maybe I have too much to finish in one time so that’s why each time I load the app there are finishing different transactions but maybe each time can finish just an amount of them and not all of them in one time.

I’m lost with this…Is there a way to finish all my pending transactions?

Thanks.

We would need specific steps to understand how these transactions were generated. You might consider just creating a new product to test with, use a new tester, or as a last resort, create a new application on Google. As another test to see if ProcessPurchase is working correctly on initialization is to purposely return Pending from ProcessPurchase from a purchase. This should trigger ProcessPurchase on the next app start. As well as purchasing a non-consumable, return Complete, then reinstall the app. This should trigger auto-restore and fire off a ProcessPurchase upon IAP initialization. Ensure you don’t have any products defined in your IAP Catalog.

Something strange here is that the same Apple ID Account on other iPhone is working fine with no pending transactions.

Are pending transactions related to a serial number iPhone or Apple ID Account?

Yes, I will test with a new product. This is just happening on an iPhone X.

Seems that I have a huge amount of pending transactions and each time I reset the phone they try to finish some but not all off them, because each time are different transactions.

Thanks.

Do you have an autorenewing subscription by chance? That could create a lot of transactions at it renews every few minutes. Transactions are associated with the Apple ID.

Yes, it is like that. Shouldn’t it stop autorenewing some time automatically?

So, I write some logs to analyze:

This is what happens first time I run the app after restarting the iphone (the transactions seems not to finish):

UnityIAP UnityEarlyTransactionObserver: Created
UnityIAP UnityEarlyTransactionObserver: Registered for lifecycle events
UnityIAP UnityEarlyTransactionObserver: Added to the payment queue
UnityIAP: Requesting 5 products
UnityIAP: Requesting product data...
UnityIAP: Received 5 products
UnityIAP: No App Receipt found
UnityIAP: No App Receipt found
OnInitialized: PASS
UnityIAP: Add transaction observer
UnityIAP UnityEarlyTransactionObserver: Request to initiate queued payments
UnityIAP: UpdatedTransactions
UnityIAP: Finishing transaction xxxxxxxxxx
UnityIAP: Finishing transaction xxxxxxxxxx
UnityIAP: Finishing transaction xxxxxxxxxx
...
UnityIAP: Finishing transaction xxxxxxxxxx

This happens when trying to buy a product that has a transaction pending:

Purchasing product:xxxxxxxx
UnityIAP: PurchaseProduct: xxxxxxxxx
UnityIAP: UpdatedTransactions
UnityIAP: DuplicateTransaction error with product xxxxxxxxx and transactionId xxxxxxxxx
onPurchaseFailedEvent(productId:xxxxxx message:smile:uplicate transaction occurred)
OnPurchaseFailed: FAIL. Product: xxxxxxxxx, PurchaseFailureReason: DuplicateTransaction

This happens when trying to buy a other product that also has transactions pending but no Duplicate message is shown:

Purchasing product:xxxxxxx
UnityIAP: PurchaseProduct: xxxxxxx
UnityIAP: UpdatedTransactions

Non of these are firing the native payment popup.

This happens if I try to run the app after first time

UnityIAP UnityEarlyTransactionObserver: Created
UnityIAP UnityEarlyTransactionObserver: Registered for lifecycle events
UnityIAP UnityEarlyTransactionObserver: Added to the payment queue
UnityIAP: Requesting 5 products
UnityIAP: Requesting product data...

Just the first time I run the app after a restart is Initializing the plugin and showing transactions pending. Non if these transactions seems to finish. Is there any option to purge all the transactions pending on these products?

Finishing transactions doesn’t fire ProcessPurchase event to complete payment.

Please provide complete steps to reproduce. How do you have Pending transactions? Auto renew don’t “stop sometime”. Although in Sandbox they renew up to 6 times. Please share the code you are using. You can safely ignore the “Finishing transaction…” message. What type of product is giving you duplicate transaction? If non-consumable or a subscription, this would be expected. If they have a current subscription, you would disable the purchase button, for example.

We have pending transaction because an error with other payments plugins from other technologies, not Unity.
Pending transactions are from a Sandbox subscriptions. Even if I ignore it, I can’t purchase any other subscriptions on the app. We don’t have any subscription active, we have cancel all of them from the Settings/AppStore/Sandbox Subscription.

The only solution I could found is restoring the iPhone.

I’m not sure why you would use two IAP plugins in the same app, I would advise against that. How are the transactions left in pending? Again, we would need steps to reproduce to offer any suggestions. But for testing non-consumables and subscriptions on iOS, I always create multiple testers and multiple IAP products.