purchaseUpdateListener triggering multiple times (sandbox, ios, subscription)
Description
After calling requestSubscription and successfully completing a payment, the purchaseUpdatedListener is triggered twice with a transaction that has the same transactionId but different verificationResultIOS. I decoded verificationResultIOS and found that only the fields deviceVerification, deviceVerificationNonce, and signedDate are different.
I also debugged the native part of the code and discovered that:
-
The first call to purchaseUpdatedListener is triggered by the native method buyProduct, which executes self.sendEvent?("purchase-updated", serialize(transaction, verification)). This directly triggers purchaseUpdatedListener()
-
The second call to purchaseUpdatedListener is triggered by the native method listenForTransactions, which also executes self.sendEvent?("purchase-updated", serialize(transaction, result)). This directly triggers purchaseUpdatedListener()
Both the first and second calls successfully execute finishTransaction.
Expected Behavior
I expect that for a single purchase, the purchaseUpdatedListener method will be triggered only once.
Environment:
- react-native-iap: 12.15.7
- react-native: 0.74.5
- Platforms: iOS, device, sandbox, storekit 2
Is your issue similar to this? Issue 1172
I’m closing all issues reported in versions below 14, as the library now supports the new architecture with NitroModules and has been completely revamped.