This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func expirationDateFor(_ identifier : String) -> Date?{ | |
return UserDefaults.standard.object(forKey: identifier) as? Date | |
} | |
let subscriptionDate = IAPManager.shared.expirationDateFor("YOUR_PRODUCT_ID") ?? Date() | |
let isActive = subscriptionDate > Date() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// IAPManager.swift | |
// http://apphud.com | |
// | |
// Created by Apphud on 04/01/2019. | |
// Copyright © 2019 Apphud. All rights reserved. | |
// | |
import UIKit | |
import StoreKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isEligibleForIntroductory(callback: @escaping (Bool) -> Void){ | |
guard let receiptUrl = Bundle.main.appStoreReceiptURL else { | |
callback(true) | |
return | |
} | |
#if DEBUG | |
let urlString = "https://sandbox.itunes.apple.com/verifyReceipt" | |
#else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"status": 0, | |
"environment": "Sandbox", | |
"receipt": { | |
"receipt_type": "ProductionSandbox", | |
"adam_id": 0, | |
"app_item_id": 0, | |
"bundle_id": "com.apphud.subscriptionstest", | |
"application_version": "1", | |
"download_id": 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"latest_receipt": "long_base64_receipt_here...", | |
"latest_receipt_info": { | |
"original_purchase_date_pst": "2020-04-01 01:12:42 America/Los_Angeles", | |
"quantity": "1", | |
"subscription_group_identifier": "20537620", | |
"unique_vendor_identifier": "A779C77C-571E-477D-B184-474DBD2F3F5C", | |
"original_purchase_date_ms": "1585728762000", | |
"expires_date_formatted": "2020-04-01 08:17:41 Etc/GMT", | |
"is_in_intro_offer_period": "true", |
OlderNewer