PlayerIO

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

ActionScript3 Reference

actionscript 3 PayVault class informationClass PayVault

Namespace: playerio
Language: ActionScript 3

Provides access to the PayVault service provided by Player.IO.

Properties

 
public
coins :Number [read-only]

The current coin balance the users PayVault. Can only be read after a successful call of refresh().

public
items :Array [read-only]

All the items currently in the users PayVault. Can only be read after a successful call of refresh().

Methods

 
public
buy (items:Array, storeItems:Boolean, callback:Function = null, errorHandler:Function = null):void

Buy items with coins.

public
consume (items:Array, callback:Function = null, errorHandler:Function = null):void

Consume items from the users vault. This will cause them to be removed from the users vault.

public
count (itemKey:String):uint

How many items of the given type (itemKey) does the user has in the vault?

public
credit (amount:uint, reason:String, callback:Function = null, errorHandler:Function = null):void

Put coins into the users vault

public
debit (amount:uint, reason:String, callback:Function = null, errorHandler:Function = null):void

Take coins out of the users vault

public
first (itemKey:String):playerio:VaultItem

Get the first item of the given type (itemKey)

public
getBuyCoinsInfo (provider:String, purchaseArguments:Object, callback:Function = null, errorHandler:Function = null):void

Gets information about how to make a coin purchase with the specified PayVault provider.

public
getBuyDirectInfo (provider:String, purchaseArguments:Object, items:Array, callback:Function = null, errorHandler:Function = null):void

Gets information about how to make a direct item purchase with the specified PayVault provider.

public
give (items:Array, callback:Function = null, errorHandler:Function = null):void

Give the user items without taking any of his coins from the vault.

public
has (itemKey:String):Boolean

Does the vault contain at least on item of the given type (itemKey)?

public
PayVault (channel:playerio.utils:HTTPChannel, client:playerio:Client):void

public
readHistory (page:uint, pageSize:uint, callback:Function = null, errorHandler:Function = null):void

Load a page of entries from the users PayVault history in reverse chronological order.

public
refresh (callback:Function = null, errorHandler:Function = null):void

Refreshes the Items and Coins from the PayVault.

public
usePaymentInfo (provider:String, providerArguments:Object, callback:Function = null, errorHandler:Function = null):void

--

PayVault.coins

public
coins :Number [read-only]

The current coin balance the users PayVault. Can only be read after a successful call of refresh().

PayVault.items

public
items :Array [read-only]

All the items currently in the users PayVault. Can only be read after a successful call of refresh().

PayVault.buy

public
buy (items:Array, storeItems:Boolean, callback:Function = null, errorHandler:Function = null):void

Buy items with coins.

Arguments

items:Array
An array of object instances; each instance contains the key of the item to buy in the PayVaultItems BigDB table and any additional payload.
storeItems:Boolean
If true, the items will be stored in the users vault, if false, it's the same as using an item directly after purchase.
callback:Function (Default = null)
method called when request where successful.
errorHandler:Function (Default = null)
method called if an error occurs during the refresh.

PayVault.consume

public
consume (items:Array, callback:Function = null, errorHandler:Function = null):void

Consume items from the users vault. This will cause them to be removed from the users vault.

Arguments

items:Array
The items to use from the users vault - this should be instances from the .items array property.
callback:Function (Default = null)
method called when request where successful.
errorHandler:Function (Default = null)
method called if an error occurs during the refresh.

PayVault.count

public
count (itemKey:String):uint

How many items of the given type (itemKey) does the user has in the vault?

Arguments

itemKey:String

PayVault.credit

public
credit (amount:uint, reason:String, callback:Function = null, errorHandler:Function = null):void

Put coins into the users vault

Arguments

amount:uint
The amount of coins to put into the users vault.
reason:String
Any string you'll later wish to retrieve with the ReadHistory() method.
callback:Function (Default = null)
method called when request where successful.
errorHandler:Function (Default = null)
method called if an error occurs during the refresh.

PayVault.debit

public
debit (amount:uint, reason:String, callback:Function = null, errorHandler:Function = null):void

Take coins out of the users vault

Arguments

amount:uint
The amount of coins to take out of the users vault.
reason:String
Any string you'll later wish to retrieve with the ReadHistory() method.
callback:Function (Default = null)
method called when request where successful.
errorHandler:Function (Default = null)
method called if an error occurs during the refresh.

PayVault.first

public
first (itemKey:String):playerio:VaultItem

Get the first item of the given type (itemKey)

Arguments

itemKey:String

PayVault.getBuyCoinsInfo

public
getBuyCoinsInfo (provider:String, purchaseArguments:Object, callback:Function = null, errorHandler:Function = null):void

Gets information about how to make a coin purchase with the specified PayVault provider.

Arguments

provider:String
Gets information about how to make a coin purchase with the specified PayVault provider.
purchaseArguments:Object
Any additional information that will be given to the PayVault provider to configure this purchase.
callback:Function (Default = null)
method called when request where successful. An object with provider specific arguments are returned to the callback. function(o:Object){...}
errorHandler:Function (Default = null)
method called if an error occurs during the refresh.

PayVault.getBuyDirectInfo

public
getBuyDirectInfo (provider:String, purchaseArguments:Object, items:Array, callback:Function = null, errorHandler:Function = null):void

Gets information about how to make a direct item purchase with the specified PayVault provider.

Arguments

provider:String
The name of the PayVault provider to use for the coin purchase.
purchaseArguments:Object
Any additional information that will be given to the PayVault provider to configure this purchase.
items:Array
An array of object instances; each instance contains the key of the item to buy and any additional payload.
callback:Function (Default = null)
method called when request where successful. An object with provider specific arguments are returned to the callback. function(o:Object){...}
errorHandler:Function (Default = null)
method called if an error occurs during the refresh.

PayVault.give

public
give (items:Array, callback:Function = null, errorHandler:Function = null):void

Give the user items without taking any of his coins from the vault.

Arguments

items:Array
An array of object instances; each instance contains the key of the item to give in the PayVaultItems BigDB table and any additional payload.
callback:Function (Default = null)
method called when request where successful.
errorHandler:Function (Default = null)
method called if an error occurs during the refresh.

PayVault.has

public
has (itemKey:String):Boolean

Does the vault contain at least on item of the given type (itemKey)?

Arguments

itemKey:String

PayVault.PayVault

public
PayVault (channel:playerio.utils:HTTPChannel, client:playerio:Client):void

Arguments

channel:playerio.utils:HTTPChannel
client:playerio:Client

PayVault.readHistory

public
readHistory (page:uint, pageSize:uint, callback:Function = null, errorHandler:Function = null):void

Load a page of entries from the users PayVault history in reverse chronological order.

Arguments

page:uint
The id of the page to load. The first page is id 1.
pageSize:uint
The amount of entries for each page.
callback:Function (Default = null)
method called when request where successful. An array if PayVaultHistoryEntry elements is returned to the callback function(history:Array){...}
errorHandler:Function (Default = null)
method called if an error occurs during the refresh.

PayVault.refresh

public
refresh (callback:Function = null, errorHandler:Function = null):void

Refreshes the Items and Coins from the PayVault.

Arguments

callback:Function (Default = null)
method called when request where successful
errorHandler:Function (Default = null)
method called if an error occurs during the refresh.

PayVault.usePaymentInfo

public
usePaymentInfo (provider:String, providerArguments:Object, callback:Function = null, errorHandler:Function = null):void

--

Arguments

provider:String
--
providerArguments:Object
--
callback:Function (Default = null)
--
errorHandler:Function (Default = null)
--