Solved

App IDs transferring subscriptions to anonymous users

  • 2 February 2022
  • 27 replies
  • 1499 views


Show first post

27 replies

Userlevel 1
Badge +2

Does anyone have any suggestions here? It’s a bit of a red flag for us at the moment. :grimacing:

 

If nothing else if anyone can confirm whether or not its the desired behaviour that the Revenue Cat SDK will automatically transfer purchases to the account that's currently logged in (even anonymous) if a user returns to our app with a different user id (or anonymous) having made a purchase previously?

If the above is true can someone confirm what role restoreTransactions() does as it seems to be happening automatically for us?

 

If this the case is our work around to never really call Purchases.logOut() and just rely on the fact that if the user logs in with a different account later, the subsequent call to Purchases.logIn() will swap them over?

 

 

Userlevel 1
Badge +2

Ok so doing some more investigation we think we understand what is happening. I’m just not 100% sure if it is desired behaviour. I’ve detailed steps to try and recreate below, hoping someone with more experience will explain if this is correct behaviour.

  • Open app and call set up (We have an anonymous id here as expected)
  • User creates an account - We call login with the id
  • User subscribes, purchase recorded in RC and alias for the User ID is set against the previous anonymous id. All good so far.
  • User logs out (Purchases.logOut)
  • User backgrounds the app (or quits?)
  • User re-opens the app (still logged out) after 5 - 15 mins (the cache period)
  • RC transfers their purchase to the anonymous ID.
Example from our app

 

{
"event_timestamp_ms": 1643903636840,
"store": "APP_STORE",
"transferred_from": [
"c56acef2-039e-4a10-8ee4-ed2c1ff3772f",
"$RCAnonymousID:4fbb22f4be4b4f1abdace65eb5edb799"
],
"transferred_to": [
"$RCAnonymousID:b4ae34bbe4a04d5da4a02f85bd37a93b"
]
}

 

Our assumption going into this was that in order to transfer a purchase you had to manually with restoreTransactions. This appears to restore the transactions to whatever user ID is currently active when it enters the foreground after the cache period is over?

One rather big downside to this behaviour is if the user then logs back into their regular account the getPurchaserInfo() returns no subscription info as its all been transferred to the anonymous user. If we return around 5 - 15 minutes later the call to getPurchaserInfo() then works as the purchase has been transferred back.

 

We could be way off base here and would really appreciate some clarification on whether this is expected or not? 

Reply