Created
June 17, 2018 12:19
-
-
Save alexFaunt/5c3e424c6c75a591d42fc6d7e9c803de to your computer and use it in GitHub Desktop.
Transaction observer example
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
switch transaction.transactionState { | |
case .purchased: | |
if let appStoreReceiptURL = Bundle.main.appStoreReceiptURL, | |
FileManager.default.fileExists(atPath: appStoreReceiptURL.path) { | |
let rawReceiptData = Data(contentsOf: appStoreReceiptURL) | |
let receiptData = rawReceiptData.base64EncodedString(options: ...) | |
currentUser.processTransaction(receiptData) { isValid in | |
if isValid { | |
queue.finishTransaction(transaction); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment