We have an app that requires the users to login before making a purchase.
We’re observing (in our sandbox testing) that occasionally a users subscription gets transferred from one of our users id’s to an anonymous id. What's quite frustrating is this is happening very infrequently and we haven’t been able to recreate it predictably.
Here is an example event (id: 0a5fc80d-ca5a-451a-8a31-cb16b95a3a92
)
{
"event_timestamp_ms": 1643816650712,
"store": "APP_STORE",
"transferred_from": [
"ce3873cc-10a7-46d0-9463-43364f6b2cb8",
"$RCAnonymousID:6a5e992f89a44858b2a8effa6996f257"
],
"transferred_to": [
"$RCAnonymousID:a0490b63949a4b6e99a3bf372b3da781"
]
}
Our touch points with the React Native SDK are rather light:
- We have an useEffect() that calls Purchases.setup(key) with our keys in our main App.tsx as per the examples.
- When a user logs into our app we call Purchases.logIn(user.id) using the response to set our initial local subscription state.
- To keep things up to date we call Purchases.getPurchaserInfo when the user brings the app back into the foreground if they are logged in and have a requestDate that's more than 5 minutes old.
- We call Purchases.logOut() when the user hits the Logout action in our UI.
Sometimes (rarely) when a user logs out and back into our app the above style event will occur.
What I can assume (but can’t validate) is somewhere in our implementation we’re causing the SDK to transfer the purchases when the user is logged out. But I'm unclear what part of the SDK would do that?
The visible effect this has on us is that the user that does log in (i.e ce3873cc-10a7-46d0-9463-43364f6b2cb8 from example event). They don't have any subscription information as its been transferred to the anonymous user. Oddly when this does happen if they log out and back in again it gets transferred back to them.
Would appreciate any guidance here as theres a good chance we’re doing something wrong but since it works 90% of the time its difficult to pin point what may be wrong.