LuxChat  2.0
Instant messenger for iOS
Class Methods | List of all members
PFPurchase Class Reference

#import <PFPurchase.h>

Inheritance diagram for PFPurchase:

Class Methods

(void) + addObserverForProduct:block:
 
(void) + buyProduct:block:
 
(void) + downloadAssetForTransaction:completion:
 
(void) + downloadAssetForTransaction:completion:progress:
 
(void) + restore
 
(nullable NSString *) + assetContentPathForProduct:
 

Detailed Description

PFPurchase provides a set of APIs for working with in-app purchases.

This class is currently for iOS only.

Method Documentation

+ (void) addObserverForProduct: (NSString *)  productIdentifier
block: (PFPurchaseProductObservationBlock)  block 

Add application logic block which is run when buying a product.

This method should be called once for each product, and should be called before calling +buyProduct:block:. All invocations to +addObserverForProduct:block: should happen within the same method, and on the main thread. It is recommended to place all invocations of this method in application:didFinishLaunchingWithOptions:.

Parameters
productIdentifierthe product identifier
blockThe block to be run when buying a product.
+ (nullable NSString *) assetContentPathForProduct: (PFProduct *)  product

Returns a content path of the asset of a product, if it was purchased and downloaded.

To download and verify purchases use +downloadAssetForTransaction:completion:.

Warning
This method will return nil, if the purchase wasn't verified or if the asset was not downloaded.
+ (void) buyProduct: (NSString *)  productIdentifier
block: (nullable PFPurchaseBuyProductResultBlock)  block 

Asynchronously* initiates the purchase for the product.

Parameters
productIdentifierthe product identifier
blockthe completion block.
+ (void) downloadAssetForTransaction: (SKPaymentTransaction *)  transaction
completion: (PFPurchaseDownloadAssetResultBlock)  completion 

Asynchronously* download the purchased asset, which is stored on Parse's server.

Parse verifies the receipt with Apple and delivers the content only if the receipt is valid.

Parameters
transactionthe transaction, which contains the receipt.
completionthe completion block.
+ (void) downloadAssetForTransaction: (SKPaymentTransaction *)  transaction
completion: (PFPurchaseDownloadAssetResultBlock)  completion
progress: (nullable PFProgressBlock)  progress 

Asynchronously* download the purchased asset, which is stored on Parse's server.

Parse verifies the receipt with Apple and delivers the content only if the receipt is valid.

Parameters
transactionthe transaction, which contains the receipt.
completionthe completion block.
progressthe progress block, which is called multiple times to reveal progress of the download.
+ (void) restore

Asynchronously* restore completed transactions for the current user.

Only nonconsumable purchases are restored. If observers for the products have been added before calling this method, invoking the method reruns the application logic associated with the purchase.

Warning
This method is only important to developers who want to preserve purchase states across different installations of the same app.

The documentation for this class was generated from the following file: