PlayerIO

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

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

iOS PayVault Provider

Setting up your iTunes Connect account

  1. Log on to iTunes Connect at https://itunesconnect.apple.com with your Apple Id.
  2. Make sure you have accepted all contracts for Paid Applications, and have your Contact Info, Bank Info and Tax Info submitted and approved. You can view this under Agreements, Tax, and Banking when logged on to iTunes Connect.
  3. Setup a new app or pick an existing one. Make sure the Bundle ID you use has In-App Purchase enabled in the provisioning portal.
  4. When viewing your app, click the Features tab to get to the In-App Purchases interface.
  5. For each amount of coins you wish to sell, you need to create a corresponding In-App Purchase item:
    • Click the plus sign and create a Consumable item.
    • The Product ID must end in .coins + amount. Since they must also be globally unique within the iTunes store, we recommend that you prefix each item with your Bundle ID, so for example com.example.mygame.coins500 would be an item that awards the user 500 coins.
    • Select a Price Tier to set a sales price for your coins.
    • Add a Display Name and a Description for your app's primary localization language. The Display Name will appear in in the purchase interface which asks the user:
      "Do you want to buy one [Display Name] for [Price]?"
      Make sure it fits that sentence, for example by setting it to Chest of 500 Coins or similar.
  6. For each PayVault item you wish to sell, you need to create a corresponding In-App Purchase item:
    • Click the plus sign and create a Consumable item.
    • The Product ID must end in .item + itemkey. Since they must also be globally unique within the iTunes store, we recommend that you prefix each item with your Bundle ID, so for example com.example.mygame.itemsupercar would be an item that awards the user the PayVault item with the itemkey supercar.
    • Select a Price Tier to set a sales price for your coins.
    • Add a Display Name and a Description for your app's primary localization language. The Display Name will appear in in the purchase interface which asks the user:
      "Do you want to buy one [Display Name] for [Price]?"
      Make sure it fits that sentence, for example by setting it to Super Car or similar.
  7. For testing, we recommend that you create one or more Sandbox Testers, which you can do under Users and Roles when logged on to iTunes Connect.

Configuring PayVault on PlayerIO

  1. Enable iOS in the PayVault Control Panel for your game.
  2. Enter your app's Bundle Id that you've setup in iTunes Connect.

Buying Coins and Items: UseBuyInfo()

Unlike the other PayVault providers, buying coins and items through iOS 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 an iOS 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 iOS 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. You must retrieve product information for the product(s) that you want to offer the user to buy, before you can request payment for that product.
  2. After requesting a payment, and it was succesful, you must retrieve the transaction receipt, which will now contain the consumable product the user purchased.
  3. Pass this receipt into the PayVault method to add the purchased coins or items to the user's Vault.
  4. Finish the transaction, which will remove the consumable items from the receipt. Failure to do this will result in the user being awarded a single consumable item multiple times.

Example of buying coins with iOS in AS3:

Required UseBuyInfo() Arguments
transactionReceipt The transactionReceipt received in the eventlistener.
Result Values
success Should be "true" if the transaction was successfully completed. You can refresh the vault and access the updated contents at this point.
productid The productid of the receipt that was sent in, that now needs to be removed from the purchase queue.
Optional Result Values
coins The amount of coins purchased, if any.
quantity The number of items purchased, if any.
item The itemkey of the item purchased, if any.