Solved

Restore purchase after App delete and reinstall with anonymous user

  • 29 July 2021
  • 5 replies
  • 753 views

Badge +1

I have a “no login” app using anonymous ID’s and working fine in a sandbox environment.

The action to take is unclear when deleting and re-installing the app or moving to a new device.

When I delete the app and re-install, I allow the user to “restoreTransactions” which fails because the app now has a new anonymous ID. If I programmatically login with the original anonymous ID, then restore works as expected.

But I don’t want to be saving ID’s anywhere after the user removes the app, right?

Am I missing something simple?

icon

Best answer by cody 29 July 2021, 23:14

View original

5 replies

Userlevel 6
Badge +8

Hey @Paul Rekieta!

If you’re using anonymous IDs, and don’t want to use custom IDs/don’t have a custom auth system, restoring purchases is the way to go here. Restoring purchases takes a user’s device receipt and syncs it with RevenueCat’s backend, where we then grant the user access to the purchases by either transferring the receipt to the new user ID or aliasing the user IDs together, depending on your configuration.

If you’re seeing restoreTransactions fail, you’ll want to be sure you’re signed into the correct Apple ID/Google Play account as it will only sync the receipt of the current account.

Badge +1

Thanks for the reply. It is working correctly when I test with a real device. The failure occurred when I was using a StoreKit configuration file. Perhaps it is expected to not work in that scenario?

Badge +2

Thanks for the reply. It is working correctly when I test with a real device. The failure occurred when I was using a StoreKit configuration file. Perhaps it is expected to not work in that scenario?

Hello @Paul Rekieta 

How could you make the app restore purchases after uninstall and reinstall again?

Badge +2

Hey @Paul Rekieta!

If you’re using anonymous IDs, and don’t want to use custom IDs/don’t have a custom auth system, restoring purchases is the way to go here. Restoring purchases takes a user’s device receipt and syncs it with RevenueCat’s backend, where we then grant the user access to the purchases by either transferring the receipt to the new user ID or aliasing the user IDs together, depending on your configuration.

If you’re seeing restoreTransactions fail, you’ll want to be sure you’re signed into the correct Apple ID/Google Play account as it will only sync the receipt of the current account.


Hello @cody 

If i have login system, how can i create custom IDs and restore purchases after reinstall the app on this basis?

Badge +1

Thanks for the reply. It is working correctly when I test with a real device. The failure occurred when I was using a StoreKit configuration file. Perhaps it is expected to not work in that scenario?

Hey there!
So I cannot test the restore purchases functionality on the simulator, right? Can you confirm that @cody ?

It seems strange but it’s probably one of these strange Apple things :( Making a purchase and listing products works well so far (with and without the StoreKit config file)

Reply