TCGBPurchasable Protocol Reference
Declared in | TCGBPurchasable.h |
---|
Overview
The protocol TCGBPurchasable is for developing IAP Adapter.
This protocol contains several methods such as to request item list, to puchasing item and retrying incompleted purchasing.
Initilaize IAP Adapter
– initializePurchaseWithAppID:store:userID:enableDebugMode:
This method ininialize the IAP Adapter class.
- (void)initializePurchaseWithAppID:(NSString *)appID store:(NSString *)store userID:(NSString *)userID enableDebugMode:(BOOL)isDebugMode
Parameters
appID |
appID is ToastCloud IAP’s appID, not ToastCloud projectID. |
---|---|
store |
store should be appstore. Others will be ignored. |
userID |
userID is obtained after logged in. This must be unique cause of tracing purchasing. |
isDebugMode |
isDebugMode is for setting debug mode of ToastCloud IAP module. |
Declared In
TCGBPurchasable.h
Request Item List
– requestItemListPurchasableWithCompletion:
required method
This is the primary method for obtaining ItemList which is registered at ToastCloud IAP Console and Apple Itunes Connect.
- (void)requestItemListPurchasableWithCompletion:(void ( ^ ) ( NSArray<TCGBPurchasableItem*> *purchasableItemArray , TCGBError *error ))completion
Parameters
completion |
completion may return the NSArray of TCGBPurchasableItem. |
---|
Discussion
Request a item list which is purchasable. This list has items which are registered in both Market(AppStore) and ToastCloud IAP Console.
Warning: You should call this method after logged in
, otherwise you will get TCGB_ERROR_NOT_LOGGED_IN error in the completion.
Declared In
TCGBPurchasable.h
– requestItemListAtIAPConsoleWithCompletion:
required method
This is the method for obtaining ItemList which is registered at ToastCloud IAP Console.
- (void)requestItemListAtIAPConsoleWithCompletion:(void ( ^ ) ( NSArray<TCGBPurchasableItem*> *purchasableItemArray , TCGBError *error ))completion
Parameters
completion |
completion may return the NSArray of TCGBPurchasableItem. |
---|
Discussion
Request a item list which is purchasable. This list has items which are only registered in ToastCloud IAP Console, not Market(AppStore)
Warning: You should call this method after logged in
, otherwise you will get TCGB_ERROR_NOT_LOGGED_IN error in the completion.
Declared In
TCGBPurchasable.h
Request Purchasing Item
– requestPurchaseWithItemSeq:gamebasePayload:viewController:completion:
required method
This is the method to request purchasing item which identifier is itemSeq. There is a viewController parameter and you may put your top most viewController. If you don’t, this method will find out top most view controller and put it in the parameter.
- (void)requestPurchaseWithItemSeq:(long)itemSeq gamebasePayload:(NSString *)gamebasePayload viewController:(UIViewController *)viewController completion:(void ( ^ ) ( TCGBPurchasableReceipt *purchasableReceipt , TCGBError *error ))completion
Parameters
itemSeq |
itemID which you want to purchase. |
---|---|
viewController |
represent to current viewcontroller. |
completion |
completion may return the TCGBPurchasableReceipt instance. |
Discussion
Request Purchasing Item that has itemId.
Warning: You should call this method after logged in
, otherwise you will get TCGB_ERROR_NOT_LOGGED_IN error in the completion.
Declared In
TCGBPurchasable.h
Request non-consumed Item List
– requestItemListOfNotConsumedWithCompletion:
required method
This method provides an item list that have non-consumed.
- (void)requestItemListOfNotConsumedWithCompletion:(void ( ^ ) ( NSArray<TCGBPurchasableReceipt*> *purchasableReceiptArray , TCGBError *error ))completion
Parameters
completion |
completion may return the NSArray of TCGBPurchasableReceipt instances. |
---|
Discussion
Request a Item List which is not consumed. You should deliver this itemReceipt to your game server to consume it or request consuming API to ToastCloud IAP Server. You may call this method after logged in and deal with these non-consumed items.
Warning: You should call this method after logged in
, otherwise you will get TCGB_ERROR_NOT_LOGGED_IN error in the completion.
Declared In
TCGBPurchasable.h
Request retry purchasing processes
– requestRetryTransactionWithCompletion:
required method
This method is for retrying failed purchasing proccesses.
- (void)requestRetryTransactionWithCompletion:(void ( ^ ) ( TCGBPurchasableRetryTransactionResult *transactionResult , TCGBError *error ))completion
Parameters
completion |
completion may return the TCGBPurchasableRetryTransactionResult which has two member variables which are named ‘successList’ and ‘failList’. |
---|
Discussion
Request a retrying transaction which is not completed to IAP Server
Declared In
TCGBPurchasable.h