Skip to main content
Question

Virtual Currency Questions


Forum|alt.badge.img+7

Hi looking into Virtual Currency for tokens in my game.  Currently on ios I save tokens to icloud so they transfer between devices but are not tied to a user account in my game.  I also save them on the keychain so they survive app delete / install.  On android I save the count in userData but that doesn’t survive app delete and that’s not great.

I haven’t associated tokens with user accounts because creating an account isn’t mandatory.. some people simply like to play the computer opponent and not online.. so they don’t need an account.  

 

So wondered if virtual currency might be a good option as rev cat creates an anon id.  But it’s complicated.  

 

For example.. assume someone installs the app the the first time, gets an AnonID and buys tokens without a userid in my app.. then they create a new account in my game and I tell RevCat about that userID.  It does look like that in-game user id gets assigned get an alias to the orig anonID and the tokens are still there.  Great

 

But if I install the app, get an AnonID , buy tokens and then login as an existing user the tokens I had bought aren’t transfered over to the new login and added to any that are there.  I can see times you’d want this and times you wouldn’t .  

 

Also right now if I a user logs out of my app I also log out of rev cat and then get a new anonID which complicates it further.  I wonder if even though someone logs out of my app I don’t want to also log out of revcat but keep it associated with the same account. .. it’s tricky.  Maybe if they log into another account then I switch the id.. Will have to do some testing.. but even explaining this and all the edge cases (which I’m sure there are more) is tricky.

 

I think the only way to do this is to require a user login to my app to use it.. but I fear that will dissuade people from trying my game as many people like to try an app for a while before entering personal info.

 

Curious if anyone else has pointers on their flow? 

 

D

4 replies

Forum|alt.badge.img+7
  • Author
  • Member
  • 8 replies
  • May 25, 2025

I put this miro board together to try and figure out a flow that might work

 

https://miro.com/app/board/uXjVIwuTzyM=/

 


MarcosC
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • 178 replies
  • May 26, 2025

Hi ​@DankLSS 

 

Thanks for the detailed message. I think that the problem you are describing makes sense, let me try to dig deeper on your scenario to see what an optimal solution would look like.

 

> But if I install the app, get an AnonID , buy tokens and then login as an existing user the tokens I had bought aren’t transfered over to the new login and added to any that are there.  I can see times you’d want this and times you wouldn’t .  

Do you know in what scenarios you would like to transfer and which ones not? There is one main problem with transferring our Virtual Currencies. What happens with currencies spent and what unlocked on your app?  In what scenarios would you like to transfer (based on what) and how would you handle that scenario?

The solution we went for now is never transfer (happy to discuss when we should do it), but we have APIs that would allow you to deduct currencies from a given user and assign currencies to another one, so you can manually implement that transfer

 

> Also right now if I a user logs out of my app I also log out of rev cat and then get a new anonID which complicates it further.  I wonder if even though someone logs out of my app I don’t want to also log out of revcat but keep it associated with the same account. .. it’s tricky.  Maybe if they log into another account then I switch the id.. Will have to do some testing.. but even explaining this and all the edge cases (which I’m sure there are more) is tricky.

Do you expect more than one account on a device? If not, I would probably not offer a logout functionality. If they login with another identified account, then you can change the account when the new login happens.

 

If you can share what you’d like to happen in all scenarios, we can discuss it and see what’s missing on our side. BTW, if you prefer to discuss this via a zoom call or in discord, let me know, so we can have faster discussions


Forum|alt.badge.img+7
  • Author
  • Member
  • 8 replies
  • May 28, 2025

Thanks for the reply.  I think 99% of the time it’s one user per device so I think that no logging out of rev cat feels like the right plan even if they log out of their acocunt.  If they then log into another account in my app I’ll also call the login for rev cat to update the userid.

 

The only time I think I’d need to transfer tokens is if an anon user (fresh install for example) buys tokens as anon and then logs into an existing account in my app which is also linked to an existing rev cat account.

 

The api is in beta and the ios sdk seems to only be available on a dev / beta branch.  I’m guessing I should hold off on doing this till the api is official? Are any users live with this feature?

 

I’d want to add/delete currency which I’ve successfully done via a web post from my backend server.  The ios sdk has a way to check your ballance but I’m not on that branch.  I noticed if I add 0 currency via the web endpoint “…/virtual_currencies/transactions” I get a json back with the balance that way but I’m guessing there’s a seperate call for just getting your balance as this sort of feels like the wrong way to use that endpoint. 

 

Thanks for the reply!


MarcosC
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • 178 replies
  • May 28, 2025

Hi ​@DankLSS ,

> The only time I think I’d need to transfer tokens is if an anon user (fresh install for example) buys tokens as anon and then logs into an existing account in my app which is also linked to an existing rev cat account.

Would you prefer in this case to transfer the purchase, or would you consider those accounts the same and prefer aliasing them?

 

> The api is in beta and the ios sdk seems to only be available on a dev / beta branch.  I’m guessing I should hold off on doing this till the api is official? Are any users live with this feature?

We have a few apps already using it live. The idea is that people use it and provide feedback to it so we can improve it. If you have any feedback about the SDK or API, let us know

 

> I’d want to add/delete currency which I’ve successfully done via a web post from my backend server.  The ios sdk has a way to check your ballance but I’m not on that branch.  I noticed if I add 0 currency via the web endpoint “…/virtual_currencies/transactions” I get a json back with the balance that way but I’m guessing there’s a seperate call for just getting your balance as this sort of feels like the wrong way to use that endpoint. 

The SDK is still in a beta branch and you can install it. All docs are here: https://www.revenuecat.com/docs/offerings/virtual-currency

There’s a specific endpoint for balances → https://www.revenuecat.com/docs/offerings/virtual-currency#reading-balances

 

Feel free to DM me if you need any help. Happy to chat about your app / implementation


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings