PayVault Guides (How do i...?)
Use these guides to get started quickly or to get inspiration for how to use PayVault in your game.
I want to use a virtual currency
Simply enable the PayVault providers you want to use in the Control Panel, and sign up for them at their respective websites, where you also choose the name and exchange rate of your currency.
In your game you can then use the GetBuyCoinsInfo() method when players need to fill up on coins, and the Debit() method whenever they use them in your game.
If you want players to be able to transfer virtual currency between each other, you can use both the Credit() and Debit() methods, but remember to use them in a secure context such as in multiplayer server code.
I want to sell the full version of my game for $10 USD.
First, set up a single PayVaultItem with an item key of “fullgame”, and create an int property called “PriceUSD” with the value “1000”.
Then enable the PayVault Providers you want to use, and sign up for them if you haven't already done so.
When your users want to buy the full game, simply use the GetBuyDirectInfo() method.
To check if a user has bought the full game, just check if their Vault contains the item you set up in the first step.
I want to have a managed shop
As always, start by enabling and signing up for the Payvault providers you want to use.
In the Control Panel, you can manage all the items in your shop. Set their itemkeys to whatever you want, add any BigDB properties that you want to describe the items such as name, stats, icon image etc. Don't forget to set the “PriceCoins” property on each item to set the price.
When you want to display your shop in the game, use the BigDB API to load items from the PayVaultItems table. Feel free to add indexes to the table as you want.
When users buy items, just use the Buy() method. When you list the items in a user's Vault, they will inherit all the properties of the underlying payvaultitem.
If an item is a consumable, you can simply use the Consume() method to remove it from the user's Vault.
Finally, you can also use the Give() method to give items to users if you want to reward them.