PlayerIO

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

  • Supports Buying Coins:
    GetBuyCoinsInfo()
  • Supports Direct Purchase:
    GetBuyDirectInfo()

Steam PayVault Provider

Setting up your Steam account

  1. Talk to your Valve representative. You should have an App ID for your game, and a Steam Publisher Key/Web API Key for accessing the Steam Web API.

Configuring PayVault on PlayerIO

  1. Enable Steam in the PayVault Control Panel for your game.
  2. Enter the Steam Publisher Key you got from Valve.
  3. If you want to allow coin purchases through Steam, you need to add one or more coin price points. Each price point is just a way of telling PayVault that the user can buy X coins for [minor units] in [currency] with PayPal.

    You specify price points as a string in the form of [minor units][currency]=[coins], with multiple price points separated by a comma.

    For example, the string: 100USD=50,75EUR=50 means that users can buy 50 coins for either $1.00 USD or €0.75 EUR with PayPal.
  4. When testing your game it is recommended that you do it through sandbox mode. This has to be enabled on a per-user basis, so you have to enter all your test Steam IDs in the Steam Sandbox Users field.

Buying Coins and Items using Steam

Depending on how you are building your Steam app, you need to access the Steamworks API in your game

Making a purchase follows this general sequence:

  1. Get the SteamID if the current user.
  2. Make the call to either GetBuyCoinsInfo() or GetBuyDirectInfo(). This will do two things:
    • The Steam Purchase overlay will be triggered in the game for the user.
    • The method callback will return the order ID of the transaction.
  3. When the user has completed the purchase, the game will receive a MicroTxnAuthorizationResponse_t event.
  4. If this event indicates success, call UseBuyInfo() with the order ID.
  5. This finalizes the purchase in both Steam and PlayerIO, and the user's vault is now updated.

Buying Coins: GetBuyCoinsInfo()

Example of buying coins with Steam in C#:

At this point, if you have the game running through Steam, you should get the Steam Overlay and a purchase authorization dialog.

In your game code, you should register a MicroTxnAuthorizationResponse_t callback handler to receive notification of the approval (or denial) event.

In that handler you need to call the UseBuyInfo() method:

Required GetBuyCoinsInfo() Arguments
steamid The 64-bit Steam ID of the user making the purchase. You can get this through SteamUser()->GetSteamID(); in the Steamworks API.
appid The App ID of your game.
currency The currency to make the purchase in. Steam supports most major currencies, and you can see the current list in the MicroTxn documentation.
You can also set this value to "auto" in which case the currency will be the user's default currency, i.e. USD for American users, EUR for European users, etc.
language The language code for the language that your purchase is listed in.
You can set this explicitly to for example "EN", but you can also get the user's current language through SteamApps()->GetCurrentGameLanguage(); in the Steamworks API.
coinamount The amount of Coins to purchase. The combination of coin amount and currency must be a defined price point in the PayVault setup.
description The description of the purchase as it will be presented to the user. This should typically be something like "1000 Coins"
Optional GetBuyCoinsInfo() Arguments
sandboxIf this value is set to "true", the purchase will be a test purchase and not require you to have money in your Steam wallet to complete.
categoryAn optional text description of a category that this item should be grouped with. This value is used for grouping sales data in backend Steam reporting and is never displayed to the user.
Result Values
orderid The order ID of this transaction. This value needs to be supplied when you call UseBuyInfo() to finalize the purchase, after you've received a notification through the MicroTxnAuthorizationResponse_t callback handler.
Required UseBuyInfo() Arguments
orderid The order ID of the transaction that you received from a successful call to GetBuyDirectInfo(). You also get this value as an argument to the callback.
Result Values
result Should be "ok" if the transaction was successfully completed. You can refresh the vault and access the updated contents at this point.

Buying Items: GetBuyDirectInfo()

Important: In addition to having Price properties, all PayVault items purchasable through Steam must also have Description and ItemId properties. You need to define one Price property per currency supported and one Description property per language supported. You can also define an optional Category property which is how the item will be grouped for Steam reporting purposes.
For this example code to work, the PayVault item with the itemkey fullversion must also have the following properties defined through the PayVault item Control Panel:

  • PriceUSD - The price in US Dollars, in cents, as an Integer property. For example 200 means $2.00.
  • ItemId - Your own identifier for the item, as an Integer property. For example 4711. This will show up in your Steam reporting.
  • DescriptionEN - The description of the item, in English, as a String property. For example Full version of the game. This will show up in the Purchase overlay for the user.

Example of buying an item directly with Steam in C#:

At this point, if you have the game running through Steam, you should get the Steam Overlay and a purchase authorization dialog.

In your game code, you should register a MicroTxnAuthorizationResponse_t callback handler to receive notification of the approval (or denial) event.

In that handler you need to call the UseBuyInfo() method:

Required GetBuyDirectInfo() Arguments
steamid The 64-bit Steam ID of the user making the purchase. You can get this through SteamUser()->GetSteamID(); in the Steamworks API.
appid The App ID of your game.
currency The currency to make the purchase in. Steam currently supports the currencies USD, GBP, EUR and RUB. There should be an up-to-date list in the MicroTxn documentation.
You can also set this value to "auto" in which case the currency will be the user's default currency, i.e. USD for American users, EUR for European users, etc.
language The language code for the language that your purchase is listed in.
You can set this explicitly to for example "EN", but you can also get the user's current language through SteamApps()->GetCurrentGameLanguage(); in the Steamworks API.
Optional GetBuyDirectInfo() Arguments
sandboxIf this value is set to "true", the purchase will be a test purchase and not require you to have money in your Steam wallet to complete.
Result Values
orderid The order ID of this transaction. This value needs to be supplied when you call UseBuyInfo() to finalize the purchase, after you've received a notification through the MicroTxnAuthorizationResponse_t callback handler.
Required UseBuyInfo() Arguments
orderid The order ID of the transaction that you received from a successful call to GetBuyDirectInfo(). You also get this value as an argument to the callback.
Result Values
result Should be "ok" if the transaction was successfully completed. You can refresh the vault and access the updated contents at this point.