react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

purchaseUpdateListener triggering multiple times (sandbox, ios, subscription)

Open RomanKurilovich opened this issue 1 year ago • 1 comments

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:

  1. 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()

  2. 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

RomanKurilovich avatar Dec 08 '24 13:12 RomanKurilovich

Is your issue similar to this? Issue 1172

JuGit-pk avatar Dec 11 '24 06:12 JuGit-pk

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.

hyochan avatar Sep 30 '25 18:09 hyochan