I really dived into this topic, perhaps 2, 3 months ago. I came to the conclusion that there is currently no way to configure this system without using your own server.
Creating unique coupon codes and using them when using is quite simple. Let the user enter the code, send a POST request to your server, hash the code both on the client side and on the server side and see if they match. Then shut down the server and configure it. However, this makes your application vulnerable to piracy (if it is not already); if you have a high-profile application, be sure to perform security checks (for example, check SSL certificates to prevent a man in the middle attack).
The tough part is restoring previously purchased “free” ones when users reinstall your application or change their phones / firmware. To do this, you will need a stable and reliable (cross-device) form of identification (for example, access to the main Google user account on the phone). If you use user-provided emails, it's too easy to simply enter someone else's email address. If you used a coupon system, I would advise against restoring the “free” ones.
Reinier
source share