RevenueCat / RevenueCat/react-native-purchases

restorePurchases returns unexpected transactionIdentifier

Open
#991 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
117
Avg merge
14h 40m
Merged PRs (30d)
40

Description

Describe the bug
When purchasing a package (consumable product), I'm storing the returned productIdentifier, purchaseDate and transactionIdentifier in my DB. I now want to implement restore logic using restorePurchases the following way:

const { nonSubscriptionTransactions } = await Purchases.restorePurchases()

My goal is to compare the restored transactions to the ones in my DB. However, the transactionId differs in the restored transactions from the original transaction.

E.g., when the original transaction for purchasePackage looks like this:

{
   "productId":"product_id",
   "productIdentifier":"product_id",
   "purchaseDate":"2024-04-30T16:16:32Z",
   "purchaseDateMillis":1714493792000,
   "revenueCatId":"2000000585921649",
   "transactionIdentifier":"2000000585921649"
}

The corresponding restored transaction looks like this:

{
   "productId":"product_id",
   "productIdentifier":"product_id",
   "purchaseDate":"2024-04-30T16:16:32Z",
   "purchaseDateMillis":1714493792000,
   "revenueCatId":"eb6f56e377",
   "transactionIdentifier":"eb6f56e377"
}

I could just link these transactions using the timestamp, but that does not seem like a clean approach. Am I misunderstanding something here?

I also noticed that the returned properties do not match the PurchasesStoreTransaction interface like specified, but that seems to be another issue.

Thanks for your help!

  1. Environment
    1. Platform: iOS & Android
    2. SDK version: 7.27.0
    3. OS version: MacOS 14.0
    4. Xcode/Android Studio version: Xcode 15.0.1
    5. React Native version: 0.72.5
    6. SDK installation (CocoaPods + version or manual): I don't understand what that is
    7. How widespread is the issue. Percentage of devices affected: All of them
  2. Debug logs that reproduce the issue
  3. Steps to reproduce, with a description of expected vs. actual behavior: Make a purchase, restore that purchase.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by tracing the restorePurchases API and the PurchasesStoreTransaction interface, then reproduce a purchase followed by restore on the reported SDK version. Done means the transaction identifier behavior and returned properties are consistent with the documented interface or clearly documented if platform behavior differs.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, ios, react-native, typescript
Domain
api, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.