VirtualCurrency Reference


Inherits From: LiObject
Declared In: VirtualCurrency.h

Overview


Applicasa's VirtualCurrency class offers developers a powerful basis for building their application's virtual store. Out of the box, Applicasa supports two types of VirtualCurrency developers can use right away—MainCurrency and SecondaryCurrency. Developers can use both kinds in whatever ways they wish, and tie both to actual In-App Purchase items users buy from the iOS and Android app stores.

The intention behind VirtualCurrency usage is that each item you offer to your users is purchased via Applicasa's IAP class API, which handles all the hard work of making real-money purchases on behalf of your users. Then, in-game currency is used when a user wishes to purchase VirtualGood items. While you can use the VirtualCurrency class directly, most typical interactions can be handled via the IAP class API.

VirtualCurrency items are managed exclusively from the Applicasa developer web portal.


Tasks


Querying Virtual Currencies

+ getVirtualCurrenciesWithBlock:

Virtual Currency Transactions

- buyVirtualCurrencyWithBlock:
+ giveAmount:ofCurrencyKind:withBlock:
+ useAmount:ofCurrencyKind:withBlock:


Properties


virtualCurrencyID

The item's unique ID value.

@property (nonatomic, retain) NSString *virtualCurrencyID;

Discussion:

This is the instance's unique ID value as recorded in the Applicasa datastore. It is set by the datastore when you create a new VirtualCurrency item via the Applicasa developer's web console. This property is not editable.

virtualCurrencyTitle

The item's display title.

@property (nonatomic, retain) NSString *virtualCurrencyTitle;

Discussion:

An NSString value for the currency item's title. You'd most often use this value to display the item's name within your app. Can be edited from the web console.

virtualCurrencyAppleIdentifier

The item's unique Apple product identifier, if listed for sale to iOS devices.

@property (nonatomic, retain) NSString *virtualCurrencyAppleIdentifier;

Discussion:

This property is editable from the web console.

virtualCurrencyGoogleIdentifier

The item's unique Google product identifier, if listed for sale to Android devices.

@property (nonatomic, retain) NSString *virtualCurrencyGoogleIdentifier;

Discussion:

This property is editable from the web console.

virtualCurrencyDescription

The item's description.

@property (nonatomic, retain) NSString *virtualCurrencyDescription;

Discussion:

This property is editable from the web console.

virtualCurrencyPrice

An NSFloat value indicating the item's sale price.

@property (nonatomic, assign) float virtualCurrencyPrice;

Discussion:

This property is editable from the web console.

virtualCurrencyCredit

An int value indicating how much currency credit a user receives after purchasing this item.

@property (nonatomic, assign) int virtualCurrencyCredit;

Discussion:

This property is editable from the web console.

virtualCurrencyKind

An int value indicating whether this item is of primary or secondary currency type.

@property (nonatomic, assign) int virtualCurrencyKind;

Discussion:

This property is editable from the web console.

virtualCurrencyImageA

An NSURL indicating the item's main image location.

@property (nonatomic, retain) NSURL *virtualCurrencyImageA;

Discussion:

This property is automatically generated and updated from the web console.

virtualCurrencyImageB

An NSURL indicating the item's secondary image location.

@property (nonatomic, retain) NSURL *virtualCurrencyImageB;

Discussion:

This property is automatically generated and updated from the web console.

virtualCurrencyImageC

An NSURL indicating the item's tertiary image location.

@property (nonatomic, retain) NSURL *virtualCurrencyImageC;

Discussion:

This property is automatically generated and updated from the web console.

virtualCurrencyIsDeal

A BOOL value indicating if the item is a special deal.

@property (nonatomic, assign) BOOL virtualCurrencyIsDeal;

Discussion:

This property is editable from the web console.

virtualCurrencyInAppleStore

A BOOL value indicating if the item is available to iOS devices.

@property (nonatomic, assign) BOOL virtualCurrencyInAppleStore;

Discussion:

This property is editable from the web console.

virtualCurrencyInGoogleStore

A BOOL value indicating if the item is available to Android devices.

@property (nonatomic, assign) BOOL virtualCurrencyInGoogleStore;

Discussion:

This property is editable from the web console.

virtualCurrencyLastUpdate

A datetime value of the last time the item was updated from the web console.

@property (nonatomic, retain, readonly) NSDate *virtualCurrencyLastUpdate;

Discussion:

This property is automatically generated and updated from the web console.

product

An internally used property for integrating with Apple's StoreKit

@property (nonatomic, retain) SKProduct *product;

Discussion:

This property is automatically generated and updated from the web console.

itunesPrice

The item's iTunes price.

@property (nonatomic, retain) NSDecimalNumber *itunesPrice;

Discussion:

This property is editable from the web console.


Class Methods


getVirtualCurrenciesWithBlock:

Instructs Applicasa to query for all available VirtualCurrency items.

+ (void) getVirtualCurrenciesWithBlock:(GetVirtualCurrencyArrayFinished)block;

Parameters:

block
A block for handling method completion that must match the signature (NSError *error, NSArray *array).

Discussion:

This method provides developers a convenient way to quickly fetch all available VirtualCurrency items. Developers can respond to method completion with a block matching the signature (NSError *error, NSArray *array), where the array argument will contain all VirtualCurrency items returned.

giveAmount:ofCurrencyKind:withBlock:

Instructs Applicasa to give VirtualCurrency of a specified type and amount to the user.

+ (void) giveAmount:(NSInteger)amount ofCurrencyKind:(LiCurrency)currencyKind withBlock:(LiBlockAction)block;

Parameters:

amount
An NSInteger indicating the amount of currency to give the user.

currencyKind
An LiCurrency enum value indicating which kind of VirtualCurrency to use for the transaction. Current allowed values are MainCurrency and SecondaryCurrency.

block
A block for handling method completion that must match the signature (NSError *error, NSString *itemID, Actions action).

Discussion:

This method allows developers the flexibility to give VirtualCurrency of a specified type and amount to the user based on criteria of their choosing within their apps. Developers may respond to method completion to handle success and failure with the block parameter. This block must match the signature (NSError *error, NSString *itemID, Actions action).

useAmount:ofCurrencyKind:withBlock:

Instructs Applicasa to deduct VirtualCurrency of a specified type and amount from the user.

+ (void) useAmount:(NSInteger)amount ofCurrencyKind:(LiCurrency)currencyKind withBlock:(LiBlockAction)block;

Parameters:

amount
An NSInteger indicating the amount of currency to deduct from the user.

currencyKind
An LiCurrency enum value indicating which kind of VirtualCurrency to use for the transaction. Current allowed values are MainCurrency and SecondaryCurrency.

block
A block for handling method completion that must match the signature (NSError *error, NSString *itemID, Actions action).

Discussion:

This method allows developers the flexibility to deduct VirtualCurrency of a specified type and amount from the user based on criteria of their choosing within their apps. Developers may respond to method completion to handle success and failure with the block parameter. This block must match the signature (NSError *error, NSString *itemID, Actions action).


Instance Methods


buyVirtualCurrencyWithBlock:

Instructs Applicasa to purchase a given VirtualCurrency item.

- (void) buyVirtualCurrencyWithBlock:(LiBlockAction)block;

Parameters:

block
A block for handling method completion that must match the signature (NSError *error, NSString *itemID, Actions action).

Discussion:

This method is intended for all real-money purchases a developer may wish to perform on behalf of users, providing them with the provided virtualCurrency item in return. Developers may respond to method completion to handle success and failure with the block parameter. This block must match the signature (NSError *error, NSString *itemID, Actions action).


  « Back to SDK Class List