PlayerIO

The fastest way to build online games without breaking a sweat.

  • Supports Buying Coins:
    UseBuyInfo()
  • Supports Direct Purchase:
    UseBuyInfo()

Google Play PayVault Provider

Setting up your app in the Google Play Developer console

  1. Log on to the Google Play Developer Console at https://play.google.com/apps/publish with your Google Account.
  2. Setup a new app or pick an existing one.
  3. When viewing your app, click on In-app Products. Make sure you have uploaded an APK with the BILLING permission, and that you have setup a Google Checkout merchant account. If you haven't, the In-app products page will remind you to do that.
  4. For each amount of coins you wish to sell, you need to create a corresponding product:
    • Create a Managed Product.
    • The Product ID must be coins + amount, so for example coins500 would be a product that awards the user 500 coins.
    • Give the product a title, description, and default price.
    • Add additional translations and local prices as needed.
  5. For each item you wish to sell, you need to create a corresponding purchase item:
    • Create an Unmanaged Product.
    • The Product ID must be item + itemkey, so for example itemsupercar would be a product that awards the user the PayVaultItem 'supercar'.
    • Give the product a title, description, and default price.
    • Add additional translations and local prices as needed.
  6. For testing, we recommend that your create one or more test users, which you can do by following the instruction on this page: https://developer.android.com/google/play/billing/billing_admin.html#billing-testing-setup

Configuring PayVault on PlayerIO

  1. Enable Google Play in the PayVault Control Panel for your game.
  2. Enter your app's base64-encoded RSA public key. You can find this on the Services & APIs tab when editing your app in the Google Play Developer Console.

Buying Coins and Items: UseBuyInfo()

Unlike the other PayVault providers, buying coins and items through Google Play doesn't require you to first call the GetBuyCoinsInfo() or GetBuyItemsInfo() methods, and you also can't specify a payload when purchasing items.

Instead, you trigger a Google Play In-app Purchase, and send the resulting receipt of that through the UseBuyInfo() method, which will then verify and update the user's vault.

Depending on how you are building your Android app, there are different ways of handling in-app purchases:

Regardless of method, here's the general sequence of events you need to follow:

  1. After requesting a payment, and it was succesful, you must retrieve the transaction receipt, which will now contain the consumable product the user purchased.
  2. Pass this receipt into the PayVault method to add the purchased coins or items to the user's Vault.
  3. Consume the in-app product from Google Play, otherwise the item will not be available for purchase again.

Example of buying coins with Google Play in Android:

Required UseBuyInfo() Arguments
inapp_signed_data The signed data received in the eventlistener.
inapp_signature The signature received in the eventlistener.
Result Values
success Should be "true" if all orders were successfully completed. A value of "false" means that some or all orders had issues.
Repeating Result Values
<orderid> The status of each order in the signed data. Contains the Product ID if everything went ok, otherwise a short error message.