GODPAPER | All Packages | All Classes | Index | Frames No Frames |
PayVault

Package | playerio
Interface | public interface PayVault

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

Public Properties

| Property | Defined By
--- | --- | ---
|  | coins : int [read-only] The current coin balance the users PayVault. | PayVault
|  | items : Array [read-only] All the items currently in the users PayVault. | PayVault

Public Methods

| Method | Defined By
--- | --- | ---
|  | buy(items:Array, storeItems:Boolean, callback:Function = null, errorHandler:Function = null):void Buy items with coins. | PayVault
|  | consume(items:Array, callback:Function = null, errorHandler:Function = null):void Consume items from the users vault. | PayVault
|  | count(itemKey:String):uint How many items of the given type (itemKey) does the user has in the vault? | PayVault
|  | credit(amount:uint, reason:String, callback:Function = null, errorHandler:Function = null):void Put coins into the users vault | PayVault
|  | debit(amount:uint, reason:String, callback:Function = null, errorHandler:Function = null):void Take coins out of the users vault | PayVault
|  | first(itemKey:String):VaultItem Get the first item of the given type (itemKey) | PayVault
|  | 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. | PayVault
|  | 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. | PayVault
|  | give(items:Array, callback:Function = null, errorHandler:Function = null):void Give the user items without taking any of his coins from the vault. | PayVault
|  | has(itemKey:String):Boolean Does the vault contain at least on item of the given type (itemKey)? | PayVault
|  | 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. | PayVault
|  | refresh(callback:Function = null, errorHandler:Function = null):void Refreshes the Items and Coins from the PayVault. | PayVault

Property Detail

coins | property

`coins:int` [read-only]

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

Implementation
`public function get coins():int`

items | property |

`items:Array` [read-only]

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

Implementation
`public function get items():Array`
Method Detail

buy | () | method

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

Buy items with coins.

Parameters

| `items:Array` — Each BuyItemInfo 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.

consume | () | method |

`public function 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.

Parameters

| `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.

count | () | method |

`public function count(itemKey:String):uint`

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

Parameters

| `itemKey:String` — itemKey of the items to count

Returns

| `uint` — The number of items of the given type that the user has in the vault

credit | () | method |

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

Put coins into the users vault

Parameters

| `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.

debit | () | method |

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

Take coins out of the users vault

Parameters

| `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.

first | () | method |

`public function first(itemKey:String):VaultItem`

Get the first item of the given type (itemKey)

Parameters

| `itemKey:String` — itemKey of the item to get

Returns

| `VaultItem` — The first instance of VaultItem that matches itemKey if we have any.

getBuyCoinsInfo | () | method |

`public function 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.

Parameters

| `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.

getBuyDirectInfo | () | method |

`public function 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.

Parameters

| `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` — Each BuyItemInfo 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.

give | () | method |

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

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

Parameters

| `items:Array` — Each BuyItemInfo 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.

has | () | method |

`public function has(itemKey:String):Boolean`

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

Parameters

| `itemKey:String` — itemKey to check for.

Returns

| `Boolean` — true if the user has at least one item of the given type (itemKey)

readHistory | () | method |

`public function 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.

Parameters

| `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.

refresh | () | method |

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

Refreshes the Items and Coins from the PayVault.

Parameters

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

Thu Jan 16 2014, 01:11 PM +08:00