IAP Reference


Inherits From: NSObject
Declared In: IAP.h

Overview


Applicasa's IAP class is intended to provide a high-level API that makes working with in-app purchases much easier on developers. It offers developers the ability to handle buying, giving, and using all VirtualCurrency and VirtualGood items in their apps. In addition, IAP also provides convenient query methods developers can use to easily fetch items they want to display to users in their in-app virtual stores.

Applicasa's In-App Purchase support is based on the common practice of building virtual stores in which users purchase in-app currency with real money, then use that virtual currency to purchase virtual goods within an app.

VirtualCurrency and VirtualGood items are managed via Applicasa's developer web console, which currently supports offering primary and secondary VirtualCurrency types, as well as unlimited categories of VirtualGood items.


Tasks


Handling Virtual Currencies

+ buyVirtualCurrency:withBlock:
+ giveAmount:ofCurrencyKind:withBlock:
+ useAmount:ofCurrencyKind:withBlock:
+ getVirtualCurrenciesWithBlock:

Handling Virtual Goods

+ buyVirtualGood:quantity:withCurrencyKind:andBlock:
+ giveVirtualGood:quantity:withBlock:
+ useVirtualGood:quantity:withBlock:
+ getVirtualGoodsOfType:withBlock:
+ getVirtualGoodCategoriesWithBlock:
+ getVirtualGoodsOfType:andCategory:withBlock:

User Balances

+ getCurrentUserMainBalance
+ getCurrentUserSecondaryBalance


Class Methods


buyVirtualCurrency:withBlock:

Instructs Applicasa to purchase a given VirtualCurrency item selected by the user.

+ (void) buyVirtualCurrency:(VirtualCurrency *)virtualCurrency withBlock:(LiBlockAction)block;

Parameters:

virtualCurrency
The VirtualCurrency item the user wishes to purchase.

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

Declared In: IAP.h

buyVirtualGood:quantity:withCurrencyKind:andBlock:

Instructs Applicasa to purchase a given VirtualGood item selected by the user, in specific quantity, and using the provided currencyKind.

+ (void) buyVirtualGood:(VirtualGood *)virtualGood quantity:(NSInteger)quantity withCurrencyKind:(LiCurrency)currencyKind andBlock:(LiBlockAction)block;

Parameters:

virtualGood
The VirtualGood item the user wishes to purchase.

quantity
The desired quantity of items to purchase.

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 is intended for all VirtualGood purchases a developer may wish to perform on behalf of users, providing them with the provided virtualGood item(s) 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).

Developers are offered the ability to choose which type of currency to use via the currencyKind parameter.

Declared In: IAP.h

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

Declared In: IAP.h

giveVirtualGood:quantity:withBlock:

Instructs Applicasa to give a VirtualGood item to the user, in specific quantity.

+ (void) giveVirtualGood:(VirtualGood *)virtualGood quantity:(NSInteger)quantity withBlock:(LiBlockAction)block;

Parameters:

virtualGood
The VirtualGood item the developer wishes to give to a user.

quantity
The desired quantity of items to give the user.

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 VirtualGood gifts and rewards for users, providing them with the virtualGood item(s) 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).

Declared In: IAP.h

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

Declared In: IAP.h

useVirtualGood:quantity:withBlock:

Instructs Applicasa to consume a VirtualGood item from the user's inventory, in specific quantity.

+ (void) useVirtualGood:(VirtualGood *)virtualGood quantity:(NSInteger)quantity withBlock:(LiBlockAction)block;

Parameters:

virtualGood
The VirtualGood item the user wishes to consume from their inventory.

quantity
The desired quantity of items to deduct from the user's inventory.

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 VirtualGood consumption, providing developers with the convenience of deducting virtualGood item(s) from a user's inventory. 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).

Declared In: IAP.h

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.

Declared In: IAP.h

getVirtualGoodsOfType:withBlock:

Instructs Applicasa to query for all available VirtualGood items of the specified VirtualGoodType.

+ (void) getVirtualGoodsOfType:(VirtualGoodType)type withBlock:(GetVirtualCurrencyArrayFinished)block;

Parameters:

type
A VirtualGoodType enum value indicating which kind of VirtualGood to use for the query. Current allowed values are All, NonInventoryItems, and InventoryItems.

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 VirtualGood items by specified VirtualGoodType. The VirtualGoodType enum currently provides three available types—all virtual goods (All), only items in a user's inventory (InventoryItems), and only items a user does not have in his or her inventory (NonInventoryItems).

Developers can respond to method completion with a block matching the signature (NSError *error, NSArray *array), where the array argument will contain all VirtualGood items returned.

Declared In: IAP.h

getVirtualGoodCategoriesWithBlock:

Instructs Applicasa to query for all available VirtualGoodCategory items.

+ (void) getVirtualGoodCategoriesWithBlock:(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 VirtualGoodCategory items that are used for organizing VirtualGood items. Developers can respond to method completion with a block matching the signature (NSError *error, NSArray *array), where the array argument will contain all VirtualGoodCategory items returned.

Declared In: IAP.h

getVirtualGoodsOfType:andCategory:withBlock:

Instructs Applicasa to query for all available VirtualGood items of the specified VirtualGoodType and VirtualGoodCategory.

+ (void) getVirtualGoodsOfType:(VirtualGoodType)type andCategory:(VirtualGoodCategory *)category withBlock:(GetVirtualCurrencyArrayFinished)block;

Parameters:

type
A VirtualGoodType enum value indicating which kind of VirtualGood to use for the query. Current allowed values are All, NonInventoryItems, and InventoryItems.

category
A VirtualGoodCategory instance indicating which category of VirtualGood to use for the query.

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 VirtualGood items by specified VirtualGoodType and VirtualGoodCategory. The VirtualGoodType enum currently provides three available types—all virtual goods (All), only items in a user's inventory (InventoryItems), and only items a user does not have in his or her inventory (NonInventoryItems). The available VirtualGoodCategory items are dependent entirely on how a developer chooses to categorize VirtualGood items in the Applicasa developer web console.

Developers can respond to method completion with a block matching the signature (NSError *error, NSArray *array), where the array argument will contain all VirtualGood items returned.

Declared In: IAP.h

getCurrentUserMainBalance

Instructs Applicasa to return the user's current main currency balance.

+ (NSInteger) getCurrentUserMainBalance;

Return Value:

An NSInteger value indicating the user's main currency balance.

Declared In: IAP.h

getCurrentUserSecondaryBalance

Instructs Applicasa to return the user's current secondary currency balance.

+ (NSInteger) getCurrentUserSecondaryBalance;

Return Value:

An NSInteger value indicating the user's secondary currency balance.

Declared In: IAP.h


  « Back to SDK Class List