Search code examples
androidin-app-purchasegoogle-playin-app-billing

Coupons for In-app Billing


We are about to release an application on the Android Market, with In-app Billing for subscription that unlocks certain features for a the subscription period.

My boss now wants me to implement varying number of "free subscriptions" in the sense that:

  1. The "lucky user" downloads & installs the application from the Android Market like any other customer (always free to install, but premium features require payment via In-app Billing).
  2. The "lucky user" receives some key via email that allows him or her to avoid going through the In-app Billing checkout process (i.e. actually pay).
  3. The key can only be used once.
  4. Entering the key via a menu item, enables subscription for X months, as if he actually paid via In-app Billing.

The "key" basically acts like a coupon, but I haven't found any such option in the Publisher's Console.

Do you know of any such feature or a simple way to implement the above without duplicating the customer database on our (the publishers) server?


Solution

  • I actually dove into this subject maybe 2, 3 months ago. My conclusion was that currently there's no way of setting up this system, without using your own server.

    Generating unique coupon-codes and expiring them on use is pretty straightforward. Let the user enter the code, send a POST-request to your server, hash the code both client- and server-side and see if they match. Next, expire the code serverside and you're set. It does however make your app vulnerable to piracy (if it isn't already); if you have a high-profile app, make sure to implement security checks (e.g. check SSL certificates to prevent a man-in-the-middle attack).

    The hard part is reinstating previously acquired 'freebies' when users reinstall your app or change phones/firmware. For this purpose you're going to need a stable and reliable (cross-device) form of identification (e.g. access to the user's main Google-account on the phone). If you use user-provided e-mailaddresses, it's too easy to just enter someone else's e-mailaddress. If you were to implement a coupon-system, I would advise against reinstating 'freebies'.