Question

Is it necessary to restore purchases on Android?

  • 18 November 2022
  • 1 reply
  • 189 views

Badge +4

Since calling `.configure` with the app user id automatically transfers purchases to the new account on Android according to the docs, is there any reason to manually call `restorePurchases` on Android? Also, does `logIn` also transfer purchases on android, or just `.configure`? should I call `.configure` again when the user changes accounts?


1 reply

Userlevel 4
Badge +8

.configure only sends purchases that haven’t been sent before, and it will only sends them the first time the user uses the app. The way this works is that the app sees the device has previous purchases on the device by checking the Google account. The device will send purchases to RC to make sure it has them since Google requires purchases have to be acknowledged - if not they are refunded, which is why .configure sends purchases on initial launch. After the first launch, it is noted that .configure was already initially called so for subsequent app launches purchases are not sent. 

 

Restore purchases is a way to send those purchases on demand anytime, it will sync purchases between the app user id and the device or Apple/Google ID. In the case of the user deleting the app and reinstalling, then .configure will send the purchases again since app deleted so no memory that sent purchases in the past. Purchases will be transferred to anonymous id unless you call configure with a known app user id. In this case, you would want to use restore purchases to transfer those back to the known app id. More info see here: https://www.revenuecat.com/docs/restoring-purchases

 

Do not call configure more than once, as the way RevenueCat’s SDK works is that .configure creates an instance of a RevenueCat object that takes care of all functionality, calling .configure more than once will mess up the functionality. You do not need to call .configure again when the user switches accounts, you just need to use .logIn() and logOut(), see here: https://www.revenuecat.com/docs/user-ids#logging-out 

 

I recommend you have a restore purchase button as configure only happens the first time the app is launched so users can use this if they delete and reinstall the app.

Reply