Newer sandbox non-subscription purchase takes precedence over older production purchase
- [x] I have updated Purchases SDK to the latest version
- [x] I have read the Contribution Guidelines
- [x] I have searched the Community
- [x] I have read docs.revenuecat.com
- [x] I have searched for existing Github issues
-
Environment
- Platform: iOS
- SDK version: main branch
- StoreKit version:
- [ ] StoreKit 1 (default on versions <5.0.0. Can be enabled in versions >=5.0.0 with
.with(storeKitVersion: .storeKit1)) - [x] StoreKit 2 (default on versions >=5.0.0)
- [ ] StoreKit 1 (default on versions <5.0.0. Can be enabled in versions >=5.0.0 with
- OS version: n/a
- Xcode version: n/a
- Device and/or simulator:
- [x] Device
- [] Simulator (not an issue because the sandbox value is respected)
- Environment:
- [x] Sandbox
- [x] TestFlight
- [x] Production
- How widespread: I believe the problem would affect any customers who have purchased a production non-subscription SKU and then for whatever reason purchased the same SKU again in TestFlight.
-
Ask if really needed but I don't think you'll need them.
-
Steps to reproduce, with a description of expected vs. actual behavior
- Arrange for a customer to have two purchases of the same non-subscription item. One, in production, should be dated earlier than one in sandbox.
- In code, request the latest customer info.
- Examine the
CustomerInfoResponse.Subscriber.allPurchasesByIDand see that the only non-subscription purchase represented in the list is from the sandbox.
-
In this scenario, the
entitlements.activeInCurrentEnvironmentvalue ends up not listing the entitlement corresponding to the production purchase, presumably because it was stripped in the process of building the entitlements array.
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
Hey @danielpunkass,
I apologize for the delay here. After taking a look at your description, I would recommend checking the following documentation, which explains how to control which users get access to entitlements in a Sandbox environment to prevent the propagation to Production.
Hope this helps!
Thanks, I wasn't really looking for a workaround. I was trying to help improve the underlying framework by reporting a bug. If RevenueCat engineers don't think it's an issue worth pursuing, that's fine. But I wasn't reporting this for customer support.
Hey @danielpunkass,
Thank you for the clarification, and thank you for the PR you created. We really appreciate your collaboration! The team is not planning to make any changes to this logic as of right now, but they will consider your suggestions. I'll go ahead and close this issue now. Please feel free to create a new one if you would like to make further suggestions or need help with any of our SDKs! 🚀