How do i check if the user has an active subscription if offline. What i want is to let the user if active subscription reach the downloaded content. And if not subscribed i want the user to see a warning telling them that there is no internet connection.
Im thinking that by checking if there is a receipt on the device and perhaps checking the datetime.
I saw that there is a way to parse the apple receipts.
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
// Get a reference to IAppleConfiguration during IAP initialization.
var appleConfig = builder.Configure<IAppleConfiguration>();
var receiptData = System.Convert.FromBase64String(appleConfig.appReceipt);
AppleReceipt receipt = new AppleValidator(AppleTangle.Data()).Validate(receiptData);
Debug.Log(receipt.bundleID);
Debug.Log(receipt.receiptCreationDate);
foreach (AppleInAppPurchaseReceipt productReceipt in receipt.inAppPurchaseReceipts) {
Debug.Log(productReceipt.transactionIdentifier);
Debug.Log(productReceipt.productIdentifier);
}
#endif
That would be one way. But a user really needs to have the Internet for IAP. The user may have cancelled their subscription on the website recently, and this wouldn’t be reflected in the receipt that you have.