Namespace: PlayerIO.GameLibrary
Language: C# / .NET
The Player.IO PayVault.
Instances of this class represent a specific user's Vault, and contains methods and properties both for inspecting and manipulating the contents.
All properties and methods that inspect the Vault requires that it is up-to-date first. This can be achieved explicitly by calling the Refresh() method or implicitly by calling any method which modifies the Vault.
Here is how to read the Coins balance:
This is how you check if an item exists:
Credit and Debit can be used like this:
Buying items with Coins is really easy. This requires that you have created an item in the PayVaultItems table in BigDB with the key "speedboost", and a property "PriceCoins" containing the price.
And here's how to consume an item:
When it's time for a user to add more Coins, you can do it like this:
And this is how to let the user buy an item directly. This requires that you have created an item in the PayVaultItems table in BigDB with the key "supercar", and a property "PriceUSD" containing the price.
Finally, there are methods for retrieveing the payment history of a user:
Properties | |||
|---|---|---|---|
| public int |
This property contains the current coin balance of this Vault. This property can only be read on an up-to-date vault. |
||
| public VaultItem[] |
This property contains the list of items in this Vault. This property can only be read on an up-to-date vault. |
||
Methods | |||
| public void |
Buy items with Coins. |
||
| public void |
Buy items with Coins. |
||
| public void |
Consume items in this Vault. This will cause them to be removed, but this action will not show up in the vault history. |
||
| public void |
Consume items in this Vault. This will cause them to be removed, but this action will not show up in the vault history. |
||
| public int |
Returns the number of items of a given itemKey is in this Vault. This method can only be called on an up-to-date vault. |
||
| public void |
Give coins to this Vault. |
||
| public void |
Give coins to this Vault. |
||
| public void |
Take coins from this Vault |
||
| public void |
Take coins from this Vault |
||
| public VaultItem |
Returns the first item of the given itemKey from this Vault. This method can only be called on an up-to-date vault. |
||
| public void |
Gets information about how to make a coin purchase with the specified PayVault provider. |
||
| public void |
Gets information about how to make a coin purchase with the specified PayVault provider. |
||
| public void |
Gets information about how to make a direct item purchase with the specified PayVault provider. |
||
| public void |
Gets information about how to make a direct item purchase with the specified PayVault provider. |
||
| public void |
Give the user items without taking any of his coins from the vault. |
||
| public void |
Give the user items without taking any of his coins from the vault. |
||
| public bool |
This method checks if the Vault contains at least one item of the given itemKey. This method can only be called on an up-to-date vault. |
||
| public void |
Loads a page of entries from this Vaults history, in reverse chronological order, i.e. newest first. |
||
| public void |
Loads a page of entries from this Vaults history, in reverse chronological order, i.e. newest first. |
||
| public void |
Refreshes this Vault, making sure the Items and Coins are up-to-date. |
||
| public void |
Refreshes this Vault, making sure the Items and Coins are up-to-date. |
||
| public int |
|
This property contains the current coin balance of this Vault. This property can only be read on an up-to-date vault.
| public VaultItem[] |
|
This property contains the list of items in this Vault. This property can only be read on an up-to-date vault.
| public void |
|
Buy items with Coins.
| bool | storeItems |
| If true, the items will be stored in the Vault. If false, the items will be consumed immediately after purchase. | |
| BuyItemInfo[] | items |
| A list of items to buy, together with any additional payload. | |
| Callback | successCallback |
| Callback that will be called if the buy is succesful. |
| public void |
|
Buy items with Coins.
| bool | storeItems |
| If true, the items will be stored in the Vault. If false, the items will be consumed immediately after purchase. | |
| BuyItemInfo[] | items |
| A list of items to buy, together with any additional payload. | |
| Callback | successCallback |
| Callback that will be called if the buy is succesful. | |
| Callback<PlayerIOError> | errorCallback |
| Callback that will be called instead of successCallback if an error occurs. |
| public void |
|
Consume items in this Vault. This will cause them to be removed, but this action will not show up in the vault history.
| VaultItem[] | items |
| The VaultItems to use from the users vault - this should be instances from the Items array property. | |
| Callback | successCallback |
| Callback that will be called if the use is succesful. |
| public void |
|
Consume items in this Vault. This will cause them to be removed, but this action will not show up in the vault history.
| VaultItem[] | items |
| The VaultItems to use from the users vault - this should be instances from the Items array property. | |
| Callback | successCallback |
| Callback that will be called if the use is succesful. | |
| Callback<PlayerIOError> | errorCallback |
| Callback that will be called instead of successCallback if an error occurs. |
| public int |
|
Returns the number of items of a given itemKey is in this Vault. This method can only be called on an up-to-date vault.
| string | itemKey |
| The itemKey of the items to count |
| public void |
|
Give coins to this Vault.
| uint | coinAmount |
| The amount of coins to give. | |
| string | reason |
| Your reason for giving the coins to this user. This will show up in the vault history, and in the PayVault admin panel for this user. | |
| Callback | successCallback |
| Callback that will be called if the credit is succesful. | |
| Callback<PlayerIOError> | errorCallback |
| Callback that will be called instead of successCallback if an error occurs. |
| public void |
|
Give coins to this Vault.
| uint | coinAmount |
| The amount of coins to give. | |
| string | reason |
| Your reason for giving the coins to this user. This will show up in the vault history, and in the PayVault admin panel for this user. | |
| Callback | successCallback |
| Callback that will be called if the credit is succesful. |
| public void |
|
Take coins from this Vault
| uint | coinAmount |
| The amount of coins to take. | |
| string | reason |
| Your reason for taking the coins from this user. This will show up in the vault history, and in the PayVault admin panel for this user. | |
| Callback | successCallback |
| Callback that will be called if the debit is succesful. | |
| Callback<PlayerIOError> | errorCallback |
| Callback that will be called instead of successCallback if an error occurs. |
| public void |
|
Take coins from this Vault
| uint | coinAmount |
| The amount of coins to take. | |
| string | reason |
| Your reason for taking the coins from this user. This will show up in the vault history, and in the PayVault admin panel for this user. | |
| Callback | successCallback |
| Callback that will be called if the debit is succesful. |
| public VaultItem |
|
Returns the first item of the given itemKey from this Vault. This method can only be called on an up-to-date vault.
| string | itemKey |
| The itemKey of the item to get |
| public void |
|
Gets information about how to make a coin purchase with the specified PayVault provider.
| string | provider |
| The name of the PayVault provider to use for the coin purchase. | |
| Dictionary<string, string> | purchaseArguments |
| Any additional information that will be given to the PayVault provider to configure this purchase. | |
| Callback<Dictionary<string, string>> | successCallback |
| Callback that will be called with information about how to proceed with the purchase. |
| public void |
|
Gets information about how to make a coin purchase with the specified PayVault provider.
| string | provider |
| The name of the PayVault provider to use for the coin purchase. | |
| Dictionary<string, string> | purchaseArguments |
| Any additional information that will be given to the PayVault provider to configure this purchase. | |
| Callback<Dictionary<string, string>> | successCallback |
| Callback that will be called with information about how to proceed with the purchase. | |
| Callback<PlayerIOError> | errorCallback |
| Callback that will be called instead of successCallback if an error occurs. |
| public void |
|
Gets information about how to make a direct item purchase with the specified PayVault provider.
| string | provider |
| The name of the PayVault provider to use for the coin purchase. | |
| Dictionary<string, string> | purchaseArguments |
| Any additional information that will be given to the PayVault provider to configure this purchase. | |
| BuyItemInfo[] | items |
| Each BuyItemInfo instance contains the key of the item to buy and any additional payload. | |
| Callback<Dictionary<string, string>> | successCallback |
| Callback that will be called with information about how to proceed with the purchase. | |
| Callback<PlayerIOError> | errorCallback |
| Callback that will be called instead of successCallback if an error occurs. |
| public void |
|
Gets information about how to make a direct item purchase with the specified PayVault provider.
| string | provider |
| The name of the PayVault provider to use for the coin purchase. | |
| Dictionary<string, string> | purchaseArguments |
| Any additional information that will be given to the PayVault provider to configure this purchase. | |
| BuyItemInfo[] | items |
| Each BuyItemInfo instance contains the key of the item to buy and any additional payload. | |
| Callback<Dictionary<string, string>> | successCallback |
| Callback that will be called with information about how to proceed with the purchase. |
| public void |
|
Give the user items without taking any of his coins from the vault.
| BuyItemInfo[] | items |
| Each BuyItemInfo instance contains the key of the item to give in the PayVaultItems BigDB table and any additional payload. | |
| Callback | successCallback |
| Callback that will be called if the give is succesfull. |
| public void |
|
Give the user items without taking any of his coins from the vault.
| BuyItemInfo[] | items |
| Each BuyItemInfo instance contains the key of the item to give in the PayVaultItems BigDB table and any additional payload. | |
| Callback | successCallback |
| Callback that will be called if the give is succesfull. | |
| Callback<PlayerIOError> | errorCallback |
| Callback that will be called instead of successCallback if an error occurs. |
| public bool |
|
This method checks if the Vault contains at least one item of the given itemKey. This method can only be called on an up-to-date vault.
| string | itemKey |
| The itemKey to check for |
| public void |
|
Loads a page of entries from this Vaults history, in reverse chronological order, i.e. newest first.
| uint | page |
| The page of entries to load. The first page has number 0. | |
| uint | pageSize |
| The number of entries per page. | |
| Callback<PayVaultHistoryEntry[]> | successCallback |
| Callback that will be called with the loaded PayVault history entries, or an empty array if none were found on the given page. |
| public void |
|
Loads a page of entries from this Vaults history, in reverse chronological order, i.e. newest first.
| uint | page |
| The page of entries to load. The first page has number 0. | |
| uint | pageSize |
| The number of entries per page. | |
| Callback<PayVaultHistoryEntry[]> | successCallback |
| Callback that will be called with the loaded PayVault history entries, or an empty array if none were found on the given page. | |
| Callback<PlayerIOError> | errorCallback |
| Callback that will be called instead of successCallback if an error occurs during the loading of history entries. |
| public void |
|
Refreshes this Vault, making sure the Items and Coins are up-to-date.
| Callback | successCallback |
| Callback that will be called when the refresh is completed | |
| Callback<PlayerIOError> | errorCallback |
| Callback that will be called instead of successCallback if an error occurs during the refresh. |
| public void |
|
Refreshes this Vault, making sure the Items and Coins are up-to-date.
| Callback | successCallback |
| Callback that will be called when the refresh is completed |