RevenueCat / react-native-purchases

React Native in-app purchases and subscriptions made easy. Support for iOS and Android.
https://www.revenuecat.com
MIT License
773 stars 84 forks source link

Transaction Identifiers do not match in Sandbox for iOS #1093

Open gfaraj opened 2 months ago

gfaraj commented 2 months ago

Describe the bug For iOS Sandbox transactions, the "transaction_id" field in the webhook is something like "StoreKitTest_Transaction_7d5df4466d669078a079d2c0d58f65d9_3" while in-app the result of purchaseProduct will have transactionIdentifier equal to just "3". I'm expecting these two things to match up for some fulfillment logic.

  1. Environment
    1. Platform: iOS
    2. SDK version: 8.2.1
    3. OS version: iOS 18.0 (also tried in 16.4)
    4. Xcode/Android Studio version:
    5. React Native version: 0.73.6
    6. SDK installation (CocoaPods + version or manual):
    7. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue
  3. Steps to reproduce, with a description of expected vs. actual behavior
    1. Call purchaseProduct for a consumable product in iOS simulator
    2. Examine result.transaction.transactionIdentifier
      1. Expected: this value is unique and matches the txn id in the webhook request
      2. Actual: this value is not unique and does not match the txn id in the webhook request
  4. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Additional context N/A

RCGitBot commented 2 months ago

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

vegaro commented 2 months ago

This is expected behavior. When using StoreKit configuration files, the transaction IDs provided by StoreKit are sequential numbers (1, 2, 3), which reset every time you start a new simulator. On the backend, we need to generate unique IDs, which is why you see a different one in the webhook.

One thing to note is that the suffix in the webhook's transaction ID (_1) matches the StoreTransaction.transactionId returned by the SDK.

When a StoreKit config file is not used, the transactionId would match the one in corresponding webhook event

gfaraj commented 1 month ago

I was hoping you could override that identifier in the app-side to have it matched, but that's fine. Not a big deal.