Hi, unfortunately I didn't find the answer to my problem in other questions or in the docs.
My app works like this:
- Users are always logged in and there are no anonymous ids ever, so I always have customIds
- Each user has credits and balances in a given period, and it's tracked in a third-party database
- The subscription gives credits each new period
- I'm using react-native-purchases, developing from android and ios
So, to implement a restore purchase in the app, I need to do in two steps:
- RevenuCat: call ‘restorePurchases’ and identify the user that had the active subscription
- Third-party online database: transfer the credits and balances from the old user to the new user
If I don't do this tranfer, the bussiness logic is broken. I would just need to get the old user ID of revenue cat (transfered from) to do this, but that's where the problem is.
In short
'’’
Revenuecat:
Purchases.restorePurchases()
Get old owner id
Third party database:
Transfer balances from old owner to new owner
‘’’
At first, I though ‘originalAppUserId’ would have this info, but it doesn't seem so. ‘originalAppUserId’ is always the same as the current user, and from what I read in the docs and questions, it seems ‘originalAppUserId’ is used when accounts are merge with anonymous ids, which is not my case. At least in sandbox, they are always equal, and I can't find the original owner.
I haven't been able to find anything else in revenue cat SDK that would let me achieve this, which is a big problem. This is a big blind spot which users are able to break the system and have infinite expenses for me.
I might be able to achieve this in some not recommended ways, such as saving the milliseconds of the purchase in the third-party database and indexing the database through it, so I would able to hopefully find the original owner (and prone to errors): but this way would be a very bad practice. I read it's not possible to retrieve the receipt with the SDK, so one other less possibility of identifying the original owner.
How can I accomplish this with revenue cat? I think this is kinda essencial feature.
I'm trying to solve this with ‘Transfer to new App User ID’, as it would fully meet apple's policy, and the two other options (‘Transfer if there are no active subscriptions’ and ‘Keep with original App User ID’) are more like “couldn't solve it, let's leave it like that”.