Reputation: 73
In the documentation for SwiftStoreKit it is written that the Receipt can be obtained using
let appleValidator = AppleReceiptValidator (service: .production, sharedSecret: "your-shared-secret")
SwiftyStoreKit.verifyReceipt (using: appleValidator, forceRefresh: false) {result in
switch result {
case .success (let receipt):
print ("Verify receipt success: \ (receipt)")
case .error (let error):
print ("Verify receipt failed: \ (error)")
}
}
however, I tried to parse and insert into the model but nothing worked. Can anyone help? need to parse latest_receipt_info or in_app
Upvotes: 1
Views: 1374
Reputation: 4824
It is mentioned in their documentation here
Use this method to get the updated receipt:
SwiftyStoreKit.fetchReceipt(forceRefresh: true) { result in
switch result {
case .success(let receiptData):
let encryptedReceipt = receiptData.base64EncodedString(options: [])
print("Fetch receipt success:\n\(encryptedReceipt)")
case .error(let error):
print("Fetch receipt failed: \(error)")
}
}
Upvotes: 0
Reputation: 626
If you want to use this library you need to implement your own logic to do the local verification of receipt.
according to README from this library
You should implement your secure logic by validating your receipt locally, or sending the encrypted receipt data and validating it in your server.
Local receipt validation is not implemented (see issue #101 for details).
This may help you https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateLocally.html#//apple_ref/doc/uid/TP40010573-CH1-SW2
Upvotes: 1