UnityPurchasing.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #import <StoreKit/StoreKit.h>
  2. // Callback to Unity identifying the subject, JSON message body and optional app receipt.
  3. // Note that App Receipts are sent separately to the JSON body for performance reasons.
  4. typedef void (*UnityPurchasingCallback)(const char* subject, const char* payload, const char* receipt, const char* transactionId);
  5. @interface ProductDefinition : NSObject
  6. @property (nonatomic, strong) NSString *id;
  7. @property (nonatomic, strong) NSString *storeSpecificId;
  8. @property (nonatomic, strong) NSString *type;
  9. @end
  10. @interface ReceiptRefresher : NSObject <SKRequestDelegate>
  11. @property (nonatomic, strong) void (^callback)(BOOL);
  12. @end
  13. @interface UnityPurchasing : NSObject <SKProductsRequestDelegate, SKPaymentTransactionObserver> {
  14. UnityPurchasingCallback messageCallback;
  15. NSMutableDictionary* validProducts;
  16. NSSet* productIds;
  17. SKProductsRequest *request;
  18. NSMutableDictionary *pendingTransactions;
  19. NSMutableSet *finishedTransactions;
  20. }
  21. + (NSArray*) deserializeProductDefs:(NSString*)json;
  22. + (ProductDefinition*) deserializeProductDef:(NSString*)json;
  23. + (NSString*) serializeProductMetadata:(NSArray*)products;
  24. -(void) restorePurchases;
  25. -(NSString*) getAppReceipt;
  26. -(void) addTransactionObserver;
  27. @property (nonatomic, strong) ReceiptRefresher* receiptRefresher;
  28. @property (nonatomic, strong) SKReceiptRefreshRequest* refreshRequest;
  29. @property BOOL simulateAskToBuyEnabled;
  30. @property (nonatomic, copy, readwrite) NSString* applicationUsername;
  31. @end