ios-unity/purchase/StoreObserver.h
2023-08-03 13:14:23 +08:00

50 lines
1.5 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
See LICENSE folder for this samples licensing information.
Abstract:
Implements the SKPaymentTransactionObserver protocol. Handles purchasing and restoring products using paymentQueue:updatedTransactions: .
*/
@import StoreKit;
#import "AppConfiguration.h"
@interface StoreObserver : NSObject <SKPaymentTransactionObserver>
+ (StoreObserver *)sharedInstance;
/**
Indicates whether the user is allowed to make payments.
- returns: true if the user is allowed to make payments and false, otherwise. Tell StoreManager to query the App Store when the user is allowed to make payments and there are product identifiers to be
queried.
*/
@property(NS_NONATOMIC_IOSONLY, readonly) BOOL isAuthorizedForPayments;
/// Indicates the cause of the purchase failure.
@property(nonatomic, copy) NSString *message;
/// Keeps track of all purchases.
@property(strong) NSMutableArray *productsPurchased;
/// Keeps track of all restored purchases.
@property(strong) NSMutableArray *productsRestored;
@property(strong) NSMutableDictionary *pendingTransactions;
@property(strong) NSMutableSet *finishedTransactions;
/// Indicates the purchase status.
@property(nonatomic) PCSPurchaseStatus status;
/// Implements the purchase of a product.
- (void)buy:(SKProduct *)product orderId:(NSString *)orderId;
- (void)finishTransaction:(NSString *)transactionIdentifier;
- (NSArray *)queryPendingTransactions;
/// Implements the restoration of previously completed purchases.
- (void)restore;
- (NSString *)getAppReceipt;
@end