Inherits NSObject.
|
typedef void(^ | LDFetchProductsCallback) (NSArray *products, NSError *error) |
|
typedef void(^ | LDValidationCompletion) (NSError *error) |
|
typedef void(^ | LDValidationHandler) (NSData *validationReceipt, NSString *productId, LDValidationCompletion completion) |
|
Adds an observer.
- Parameters
-
Returns YES if the device is allowed to make payments.
- Returns
- True if the device is allowed to make payments.
- (NSInteger) consume: |
|
(NSString *) |
productId |
quantity: |
|
(NSInteger) |
quantity |
|
|
| |
Consumes a quantity of consumable products. Uses the local purchase database, so it only works if savePurchases property is enabled.
- Parameters
-
productId | The product id. |
quantity | The quantity of the product. |
- Returns
- The quantity of consumed purchases.
- (void) fetchProducts: |
|
(NSArray *) |
productIds |
completion: |
|
(LDFetchProductsCallback) |
completion |
|
|
| |
Requests information about products from Apple Store. Products are saved in a local DB if saveProducts property is set to YES.
- Parameters
-
productIds | The ids of the products. |
completion | Completion. |
- (void) finishPurchase: |
|
(NSString *) |
transactionId |
|
Removes a finished purchase transaction from the queue.
- Parameters
-
transactionId | The transaction id. |
- See also
- autoFinishPurchases. If the property is set finishPurchase is automatically called.
- (BOOL) isPurchased: |
|
(NSString *) |
productId |
|
Returns YES if the product is purchased. Uses the local purchase database, so it only works if savePurchases property is enabled.
- Parameters
-
productId | The product id of the product to check. |
- Returns
- True if the product is purchased.
Gets product info for product indetifier It uses a local cache, so fetchProducts have to be called before if products are not saved from previus executions.
- Parameters
-
identifier | The id of the product to get. |
- Returns
- The product that has that id.
- (void) purchase: |
|
(NSString *) |
productId |
completion: |
|
(void(^)(NSError *error)) |
completion |
|
|
| |
Purchases a product.
- Parameters
-
productId | The id of the product to purchase. |
completion | An error if the process fails. |
- See also
- LDInAppPurchaseObserver
- (void) purchase: |
|
(NSString *) |
productId |
quantity: |
|
(NSInteger) |
quantity |
completion: |
|
(void(^)(NSError *error)) |
completion |
|
|
| |
Purchases a quantity of a specific product.
- Parameters
-
productId | The id of the purchased product. |
quantity | The quatity to purchase. |
completion | An error if the process fails. |
- See also
- LDInAppPurchaseObserver
Removes an observer.
- Parameters
-
- (void) restorePurchases: |
|
(void(^)(NSError *error)) |
completion |
|
- (void) setLudeiServerValidationHandler |
|
|
|
Use Ludei's server to validate purchases. To enable validatioon using Ludei's server you first need to create an account in Ludei's Cloud server and create a project with you bundleId.
- (void) setValidationHandler: |
|
(LDValidationHandler) |
handler |
|
Sets a custom purchase validation handler. Purchases are always validated to TRUE by default. Set a custom validation handler to use you own custom server to validate purchases.
- Parameters
-
handler | The custom validation handler. |
Starts processing transactions and receiving LDInAppPurchaseObserver notifications. You have to call this method when your LDInAppPurchaseObservers are ready.
- (NSInteger) stockOfProduct: |
|
(NSString *) |
productId |
|
Returns the quantity of available items for a specific productId. Uses the local purchase database, so it only works if savePurchases property is enabled. For consumable products it returns the avaiable items. For non consumable products it returns 1 i purchased, 0 otherwise.
- Parameters
-
productId | The product id of the product to check. |
- Returns
- The stock of the given product.
- (BOOL) autoFinishPurchases |
|
readwritenonatomicassign |
Defines if purchases should finish automatically or not.
- (NSMutableArray*) products |
|
readnonatomicassign |
The documentation for this class was generated from the following file: