No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UnityPurchasing.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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, const char* originalTransactionId, bool isRestored);
  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, NSString*);
  12. @end
  13. @interface UnityPurchasing : NSObject<SKProductsRequestDelegate, SKPaymentTransactionObserver>
  14. {
  15. UnityPurchasingCallback messageCallback;
  16. NSMutableDictionary* validProducts;
  17. NSSet* productIds;
  18. SKProductsRequest *request;
  19. NSMutableDictionary *pendingTransactions;
  20. NSMutableSet *finishedTransactions;
  21. // Dictionary that maps product IDs to the most recent transaction receipt (base 64 encoded).
  22. NSMutableDictionary<NSString *, NSString *> *transactionReceipts;
  23. }
  24. + (NSArray*)deserializeProductDefs:(NSString*)json;
  25. + (ProductDefinition*)deserializeProductDef:(NSString*)json;
  26. + (NSString*)serializeProductMetadata:(NSArray*)products;
  27. - (void)restorePurchases;
  28. - (NSString*)getAppReceipt;
  29. - (NSString*)getTransactionReceiptForProductId:(NSString *)productId;
  30. - (void)addTransactionObserver;
  31. @property (nonatomic, strong) ReceiptRefresher* receiptRefresher;
  32. @property (nonatomic, strong) SKReceiptRefreshRequest* refreshRequest;
  33. @property BOOL simulateAskToBuyEnabled;
  34. @property (nonatomic, copy, readwrite) NSString* applicationUsername;
  35. @property (nonatomic) BOOL interceptPromotionalPurchases;
  36. @end