Validate In-App Purchase Receipt Locally
- Build your OpenSSL static library file
- Import .h and .a files into your project
- Set
Header Search Paths
andUser Header Search Paths
- Add .a files into
Linked Frameworks and Libraries
- Note: bundle id and version must be hardcoded.
let validator = QWReceiptValidator.sharedInstance()
validator.validateReceipt(withBundleIdentifier: "your.Bundle.Id", bundleVersion: "1", refresh: true, success: { (receipt) in
// Handle Success
// TODO: Parse the in-apps data and deliver content
/*
for iap in receipt.in_app {
if iap.cancellation_date == nil &&
iap.expires_date != nil &&
Date().compare(iap.original_purchase_date) == .orderedDescending &&
Date().compare(iap.expires_date!) == .orderedAscending {
// ...
}
*/
}) { (error) in
// Handle Failure
}