Integrating in-app billing
When Google Play is set up to handle in-app billing, the app must first connect to the Google Play service before it can request product details and make purchases.
Getting ready
Before the app can connect to Google Play, we need to create an app listing on the Google Play Developer Console (http://play.google.com/apps/publish).
How to do it...
Our first requirement before adding in-app billing to our app is the app's public key from Google Play:
- We need to copy the Base64-encoded public key from the console under the app's Services & APIs section:
- Then, we paste that key into our app. For testing purposes, we can just store it in a field, but we should always obfuscate this key:
private const string PublicKey = "<app-license-key>";
Next, we will integrate the in-app billing library into our app:
- To integrate the in-app billing library into our app, we first install the Xamarin.InAppBilling Component from the Xamarin...