How to create a remove ads in app purchase for unity android game?

Hi guys,

Finished implementing admob banner and interstitial ads but want to ad an in app purchase to remove ads for a Unity Android Game.

I read that somewhere that using playerspref to store the purchase however if the user uninstalls or deletes the data then the ads will return.

What is a good way to implement the remove ads in app purchase, it would be really appreciated if you could link me or provide some detailed code. I don’t seem to find really good examples of doing it from scratch beside people trying to sell plugins. I would prefer if there was a free plugin or we can create the function ourselves.

Thanks in advance guys!

use firebase