RevenueCat / RevenueCat/react-native-purchases
restorePurchases returns unexpected transactionIdentifier
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 117
- Avg merge
- 14h 40m
- Merged PRs (30d)
- 40
Description
- I have updated Purchases SDK to the latest version
- I have read the Contribution Guidelines
- I have searched the Community
- I have read docs.revenuecat.com
- I have searched for existing Github issues
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!
- Environment
- Platform: iOS & Android
- SDK version: 7.27.0
- OS version: MacOS 14.0
- Xcode/Android Studio version: Xcode 15.0.1
- React Native version: 0.72.5
- SDK installation (CocoaPods + version or manual): I don't understand what that is
- How widespread is the issue. Percentage of devices affected: All of them
- Debug logs that reproduce the issue
- Steps to reproduce, with a description of expected vs. actual behavior: Make a purchase, restore that purchase.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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