How do I use SKReceiptRefreshRequest to restore a purchase in StoreKit in iOS?
up vote
0
down vote
favorite
From all the other answers on stackoverflow, I have not found the answer to this particular question.
I am using SKReceiptRefreshRequest to restore a purchase. I am using a sandbox account. I have the following code:
let request = SKReceiptRefreshRequest()
request.delegate = self
request.start()
When the result is a call to requestDidFinish of the SKRequestDelegate protocol. The request I get back has nil for its receiptProperties property. How do I interpret that? The documentation (Refreshing the App Receipt) says to check the receipt, but there appears to be nothing to check.
Here is my code when I assume that getting a request back with nil receiptProperties mean that I received back a receipt.
extension SettingsTableViewController: SKRequestDelegate {
func requestDidFinish(_ request: SKRequest) {
print("requestDidFinish")
print("request=", request)
if let receiptRefreshRequest = request as? SKReceiptRefreshRequest {
print("receipt properties=", receiptRefreshRequest.receiptProperties as Any)
}
if iCloudAvailable() {
ubiquitousKeyValueStore.set(true, forKey: UbiquitousKeys.iMessageExtension)
let alertMessage = "iMessage Saved Messages has been restored."
let alert = UIAlertController(title: nil, message: alertMessage, preferredStyle: .alert)
let actionOK = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(actionOK)
present(alert, animated: true, completion: nil)
}
}
func request(_ request: SKRequest, didFailWithError error: Error) {
print("requst(_:didFailWithError:)")
if let receiptRefreshRequest = request as? SKReceiptRefreshRequest {
print("receipt properties=", receiptRefreshRequest.receiptProperties as Any)
} else {
print("request=", request)
}
print("error=", error)
let alertMessage = "There are no purchases to restore."
let alert = UIAlertController(title: nil, message: alertMessage, preferredStyle: .alert)
let actionOK = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(actionOK)
present(alert, animated: true, completion: nil)
}
}
ios in-app-purchase
add a comment |
up vote
0
down vote
favorite
From all the other answers on stackoverflow, I have not found the answer to this particular question.
I am using SKReceiptRefreshRequest to restore a purchase. I am using a sandbox account. I have the following code:
let request = SKReceiptRefreshRequest()
request.delegate = self
request.start()
When the result is a call to requestDidFinish of the SKRequestDelegate protocol. The request I get back has nil for its receiptProperties property. How do I interpret that? The documentation (Refreshing the App Receipt) says to check the receipt, but there appears to be nothing to check.
Here is my code when I assume that getting a request back with nil receiptProperties mean that I received back a receipt.
extension SettingsTableViewController: SKRequestDelegate {
func requestDidFinish(_ request: SKRequest) {
print("requestDidFinish")
print("request=", request)
if let receiptRefreshRequest = request as? SKReceiptRefreshRequest {
print("receipt properties=", receiptRefreshRequest.receiptProperties as Any)
}
if iCloudAvailable() {
ubiquitousKeyValueStore.set(true, forKey: UbiquitousKeys.iMessageExtension)
let alertMessage = "iMessage Saved Messages has been restored."
let alert = UIAlertController(title: nil, message: alertMessage, preferredStyle: .alert)
let actionOK = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(actionOK)
present(alert, animated: true, completion: nil)
}
}
func request(_ request: SKRequest, didFailWithError error: Error) {
print("requst(_:didFailWithError:)")
if let receiptRefreshRequest = request as? SKReceiptRefreshRequest {
print("receipt properties=", receiptRefreshRequest.receiptProperties as Any)
} else {
print("request=", request)
}
print("error=", error)
let alertMessage = "There are no purchases to restore."
let alert = UIAlertController(title: nil, message: alertMessage, preferredStyle: .alert)
let actionOK = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(actionOK)
present(alert, animated: true, completion: nil)
}
}
ios in-app-purchase
Show your actual code for creating the request and handling the response.
– rmaddy
Nov 10 at 5:05
@rmaddy I just added the code in the post above. I assumed that getting a request back in requestDidFinish with nil for receiptProperties means there is a receipt available.
– Daniel Brower
Nov 10 at 6:08
Show how you really create theSKReceiptRefreshRequest
instance. Theinit
takes a parameter. And be sure you read the documentation forSKReceiptRefreshRequest
and itsinit
.
– rmaddy
Nov 10 at 6:28
@rmaddy None of the states that make up the receiptProperties seemed to apply, so I didn't use any of the parameters. I used the code just as it says in the documentation I gave a link to in the post.
– Daniel Brower
Nov 10 at 6:45
@rmaddy Did I get this right? How do I distinguish the receipt for one product from the receipt of another product?
– Daniel Brower
Nov 20 at 3:32
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
From all the other answers on stackoverflow, I have not found the answer to this particular question.
I am using SKReceiptRefreshRequest to restore a purchase. I am using a sandbox account. I have the following code:
let request = SKReceiptRefreshRequest()
request.delegate = self
request.start()
When the result is a call to requestDidFinish of the SKRequestDelegate protocol. The request I get back has nil for its receiptProperties property. How do I interpret that? The documentation (Refreshing the App Receipt) says to check the receipt, but there appears to be nothing to check.
Here is my code when I assume that getting a request back with nil receiptProperties mean that I received back a receipt.
extension SettingsTableViewController: SKRequestDelegate {
func requestDidFinish(_ request: SKRequest) {
print("requestDidFinish")
print("request=", request)
if let receiptRefreshRequest = request as? SKReceiptRefreshRequest {
print("receipt properties=", receiptRefreshRequest.receiptProperties as Any)
}
if iCloudAvailable() {
ubiquitousKeyValueStore.set(true, forKey: UbiquitousKeys.iMessageExtension)
let alertMessage = "iMessage Saved Messages has been restored."
let alert = UIAlertController(title: nil, message: alertMessage, preferredStyle: .alert)
let actionOK = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(actionOK)
present(alert, animated: true, completion: nil)
}
}
func request(_ request: SKRequest, didFailWithError error: Error) {
print("requst(_:didFailWithError:)")
if let receiptRefreshRequest = request as? SKReceiptRefreshRequest {
print("receipt properties=", receiptRefreshRequest.receiptProperties as Any)
} else {
print("request=", request)
}
print("error=", error)
let alertMessage = "There are no purchases to restore."
let alert = UIAlertController(title: nil, message: alertMessage, preferredStyle: .alert)
let actionOK = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(actionOK)
present(alert, animated: true, completion: nil)
}
}
ios in-app-purchase
From all the other answers on stackoverflow, I have not found the answer to this particular question.
I am using SKReceiptRefreshRequest to restore a purchase. I am using a sandbox account. I have the following code:
let request = SKReceiptRefreshRequest()
request.delegate = self
request.start()
When the result is a call to requestDidFinish of the SKRequestDelegate protocol. The request I get back has nil for its receiptProperties property. How do I interpret that? The documentation (Refreshing the App Receipt) says to check the receipt, but there appears to be nothing to check.
Here is my code when I assume that getting a request back with nil receiptProperties mean that I received back a receipt.
extension SettingsTableViewController: SKRequestDelegate {
func requestDidFinish(_ request: SKRequest) {
print("requestDidFinish")
print("request=", request)
if let receiptRefreshRequest = request as? SKReceiptRefreshRequest {
print("receipt properties=", receiptRefreshRequest.receiptProperties as Any)
}
if iCloudAvailable() {
ubiquitousKeyValueStore.set(true, forKey: UbiquitousKeys.iMessageExtension)
let alertMessage = "iMessage Saved Messages has been restored."
let alert = UIAlertController(title: nil, message: alertMessage, preferredStyle: .alert)
let actionOK = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(actionOK)
present(alert, animated: true, completion: nil)
}
}
func request(_ request: SKRequest, didFailWithError error: Error) {
print("requst(_:didFailWithError:)")
if let receiptRefreshRequest = request as? SKReceiptRefreshRequest {
print("receipt properties=", receiptRefreshRequest.receiptProperties as Any)
} else {
print("request=", request)
}
print("error=", error)
let alertMessage = "There are no purchases to restore."
let alert = UIAlertController(title: nil, message: alertMessage, preferredStyle: .alert)
let actionOK = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(actionOK)
present(alert, animated: true, completion: nil)
}
}
ios in-app-purchase
ios in-app-purchase
edited Nov 10 at 6:12
asked Nov 10 at 3:54
Daniel Brower
9910
9910
Show your actual code for creating the request and handling the response.
– rmaddy
Nov 10 at 5:05
@rmaddy I just added the code in the post above. I assumed that getting a request back in requestDidFinish with nil for receiptProperties means there is a receipt available.
– Daniel Brower
Nov 10 at 6:08
Show how you really create theSKReceiptRefreshRequest
instance. Theinit
takes a parameter. And be sure you read the documentation forSKReceiptRefreshRequest
and itsinit
.
– rmaddy
Nov 10 at 6:28
@rmaddy None of the states that make up the receiptProperties seemed to apply, so I didn't use any of the parameters. I used the code just as it says in the documentation I gave a link to in the post.
– Daniel Brower
Nov 10 at 6:45
@rmaddy Did I get this right? How do I distinguish the receipt for one product from the receipt of another product?
– Daniel Brower
Nov 20 at 3:32
add a comment |
Show your actual code for creating the request and handling the response.
– rmaddy
Nov 10 at 5:05
@rmaddy I just added the code in the post above. I assumed that getting a request back in requestDidFinish with nil for receiptProperties means there is a receipt available.
– Daniel Brower
Nov 10 at 6:08
Show how you really create theSKReceiptRefreshRequest
instance. Theinit
takes a parameter. And be sure you read the documentation forSKReceiptRefreshRequest
and itsinit
.
– rmaddy
Nov 10 at 6:28
@rmaddy None of the states that make up the receiptProperties seemed to apply, so I didn't use any of the parameters. I used the code just as it says in the documentation I gave a link to in the post.
– Daniel Brower
Nov 10 at 6:45
@rmaddy Did I get this right? How do I distinguish the receipt for one product from the receipt of another product?
– Daniel Brower
Nov 20 at 3:32
Show your actual code for creating the request and handling the response.
– rmaddy
Nov 10 at 5:05
Show your actual code for creating the request and handling the response.
– rmaddy
Nov 10 at 5:05
@rmaddy I just added the code in the post above. I assumed that getting a request back in requestDidFinish with nil for receiptProperties means there is a receipt available.
– Daniel Brower
Nov 10 at 6:08
@rmaddy I just added the code in the post above. I assumed that getting a request back in requestDidFinish with nil for receiptProperties means there is a receipt available.
– Daniel Brower
Nov 10 at 6:08
Show how you really create the
SKReceiptRefreshRequest
instance. The init
takes a parameter. And be sure you read the documentation for SKReceiptRefreshRequest
and its init
.– rmaddy
Nov 10 at 6:28
Show how you really create the
SKReceiptRefreshRequest
instance. The init
takes a parameter. And be sure you read the documentation for SKReceiptRefreshRequest
and its init
.– rmaddy
Nov 10 at 6:28
@rmaddy None of the states that make up the receiptProperties seemed to apply, so I didn't use any of the parameters. I used the code just as it says in the documentation I gave a link to in the post.
– Daniel Brower
Nov 10 at 6:45
@rmaddy None of the states that make up the receiptProperties seemed to apply, so I didn't use any of the parameters. I used the code just as it says in the documentation I gave a link to in the post.
– Daniel Brower
Nov 10 at 6:45
@rmaddy Did I get this right? How do I distinguish the receipt for one product from the receipt of another product?
– Daniel Brower
Nov 20 at 3:32
@rmaddy Did I get this right? How do I distinguish the receipt for one product from the receipt of another product?
– Daniel Brower
Nov 20 at 3:32
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
I found this webpage with the answer. Apple's documentation didn't show this where it was needed.
"Restoring non-consumable IAPs in iOS" at upbeat.it
func validateReceipt() {
let recURL = Bundle.main.appStoreReceiptURL!
let contents = NSData(contentsOf: recURL)
let receiptData = contents!.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
print(receiptData)
let requestContents = ["receipt-data" : receiptData]
print(requestContents)
let requestData = try? JSONSerialization.data(withJSONObject: requestContents, options: )
print(requestData)
let serverURL = "https://sandbox.itunes.apple.com/verifyReceipt" // TODO:change this in production with https://buy.itunes.apple.com/verifyReceipt
let url = NSURL(string: serverURL)
let request = NSMutableURLRequest(url: url! as URL)
request.httpMethod = "POST"
request.httpBody = requestData
let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: {data, response, error -> Void in
guard let data = data, error == nil else {
self.notifyReceiptResult(false)
return
}
do {
let json = try JSONSerialization.jsonObject(with: data, options:) as? [String: Any]
if let receipt = json?["receipt"] as? [String: AnyObject],
let inApp = receipt["in_app"] as? [AnyObject] {
print(inApp)
if (inApp.count > 0) {
self.notifyReceiptResult(true)
} else {
self.notifyReceiptResult(false)
}
}
}
catch let error as NSError {
print(error)
self.notifyReceiptResult(false)
}
})
task.resume()
}
It looks like this stackoverflow post answers the question too. How to get iOS appStoreReceiptURL into Base 64 Encoded String
– Daniel Brower
Nov 21 at 0:48
That’s great but a link is not an answer.
– matt
Nov 21 at 0:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53235869%2fhow-do-i-use-skreceiptrefreshrequest-to-restore-a-purchase-in-storekit-in-ios%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I found this webpage with the answer. Apple's documentation didn't show this where it was needed.
"Restoring non-consumable IAPs in iOS" at upbeat.it
func validateReceipt() {
let recURL = Bundle.main.appStoreReceiptURL!
let contents = NSData(contentsOf: recURL)
let receiptData = contents!.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
print(receiptData)
let requestContents = ["receipt-data" : receiptData]
print(requestContents)
let requestData = try? JSONSerialization.data(withJSONObject: requestContents, options: )
print(requestData)
let serverURL = "https://sandbox.itunes.apple.com/verifyReceipt" // TODO:change this in production with https://buy.itunes.apple.com/verifyReceipt
let url = NSURL(string: serverURL)
let request = NSMutableURLRequest(url: url! as URL)
request.httpMethod = "POST"
request.httpBody = requestData
let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: {data, response, error -> Void in
guard let data = data, error == nil else {
self.notifyReceiptResult(false)
return
}
do {
let json = try JSONSerialization.jsonObject(with: data, options:) as? [String: Any]
if let receipt = json?["receipt"] as? [String: AnyObject],
let inApp = receipt["in_app"] as? [AnyObject] {
print(inApp)
if (inApp.count > 0) {
self.notifyReceiptResult(true)
} else {
self.notifyReceiptResult(false)
}
}
}
catch let error as NSError {
print(error)
self.notifyReceiptResult(false)
}
})
task.resume()
}
It looks like this stackoverflow post answers the question too. How to get iOS appStoreReceiptURL into Base 64 Encoded String
– Daniel Brower
Nov 21 at 0:48
That’s great but a link is not an answer.
– matt
Nov 21 at 0:50
add a comment |
up vote
1
down vote
I found this webpage with the answer. Apple's documentation didn't show this where it was needed.
"Restoring non-consumable IAPs in iOS" at upbeat.it
func validateReceipt() {
let recURL = Bundle.main.appStoreReceiptURL!
let contents = NSData(contentsOf: recURL)
let receiptData = contents!.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
print(receiptData)
let requestContents = ["receipt-data" : receiptData]
print(requestContents)
let requestData = try? JSONSerialization.data(withJSONObject: requestContents, options: )
print(requestData)
let serverURL = "https://sandbox.itunes.apple.com/verifyReceipt" // TODO:change this in production with https://buy.itunes.apple.com/verifyReceipt
let url = NSURL(string: serverURL)
let request = NSMutableURLRequest(url: url! as URL)
request.httpMethod = "POST"
request.httpBody = requestData
let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: {data, response, error -> Void in
guard let data = data, error == nil else {
self.notifyReceiptResult(false)
return
}
do {
let json = try JSONSerialization.jsonObject(with: data, options:) as? [String: Any]
if let receipt = json?["receipt"] as? [String: AnyObject],
let inApp = receipt["in_app"] as? [AnyObject] {
print(inApp)
if (inApp.count > 0) {
self.notifyReceiptResult(true)
} else {
self.notifyReceiptResult(false)
}
}
}
catch let error as NSError {
print(error)
self.notifyReceiptResult(false)
}
})
task.resume()
}
It looks like this stackoverflow post answers the question too. How to get iOS appStoreReceiptURL into Base 64 Encoded String
– Daniel Brower
Nov 21 at 0:48
That’s great but a link is not an answer.
– matt
Nov 21 at 0:50
add a comment |
up vote
1
down vote
up vote
1
down vote
I found this webpage with the answer. Apple's documentation didn't show this where it was needed.
"Restoring non-consumable IAPs in iOS" at upbeat.it
func validateReceipt() {
let recURL = Bundle.main.appStoreReceiptURL!
let contents = NSData(contentsOf: recURL)
let receiptData = contents!.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
print(receiptData)
let requestContents = ["receipt-data" : receiptData]
print(requestContents)
let requestData = try? JSONSerialization.data(withJSONObject: requestContents, options: )
print(requestData)
let serverURL = "https://sandbox.itunes.apple.com/verifyReceipt" // TODO:change this in production with https://buy.itunes.apple.com/verifyReceipt
let url = NSURL(string: serverURL)
let request = NSMutableURLRequest(url: url! as URL)
request.httpMethod = "POST"
request.httpBody = requestData
let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: {data, response, error -> Void in
guard let data = data, error == nil else {
self.notifyReceiptResult(false)
return
}
do {
let json = try JSONSerialization.jsonObject(with: data, options:) as? [String: Any]
if let receipt = json?["receipt"] as? [String: AnyObject],
let inApp = receipt["in_app"] as? [AnyObject] {
print(inApp)
if (inApp.count > 0) {
self.notifyReceiptResult(true)
} else {
self.notifyReceiptResult(false)
}
}
}
catch let error as NSError {
print(error)
self.notifyReceiptResult(false)
}
})
task.resume()
}
I found this webpage with the answer. Apple's documentation didn't show this where it was needed.
"Restoring non-consumable IAPs in iOS" at upbeat.it
func validateReceipt() {
let recURL = Bundle.main.appStoreReceiptURL!
let contents = NSData(contentsOf: recURL)
let receiptData = contents!.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
print(receiptData)
let requestContents = ["receipt-data" : receiptData]
print(requestContents)
let requestData = try? JSONSerialization.data(withJSONObject: requestContents, options: )
print(requestData)
let serverURL = "https://sandbox.itunes.apple.com/verifyReceipt" // TODO:change this in production with https://buy.itunes.apple.com/verifyReceipt
let url = NSURL(string: serverURL)
let request = NSMutableURLRequest(url: url! as URL)
request.httpMethod = "POST"
request.httpBody = requestData
let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: {data, response, error -> Void in
guard let data = data, error == nil else {
self.notifyReceiptResult(false)
return
}
do {
let json = try JSONSerialization.jsonObject(with: data, options:) as? [String: Any]
if let receipt = json?["receipt"] as? [String: AnyObject],
let inApp = receipt["in_app"] as? [AnyObject] {
print(inApp)
if (inApp.count > 0) {
self.notifyReceiptResult(true)
} else {
self.notifyReceiptResult(false)
}
}
}
catch let error as NSError {
print(error)
self.notifyReceiptResult(false)
}
})
task.resume()
}
edited Nov 21 at 0:54
answered Nov 21 at 0:44
Daniel Brower
9910
9910
It looks like this stackoverflow post answers the question too. How to get iOS appStoreReceiptURL into Base 64 Encoded String
– Daniel Brower
Nov 21 at 0:48
That’s great but a link is not an answer.
– matt
Nov 21 at 0:50
add a comment |
It looks like this stackoverflow post answers the question too. How to get iOS appStoreReceiptURL into Base 64 Encoded String
– Daniel Brower
Nov 21 at 0:48
That’s great but a link is not an answer.
– matt
Nov 21 at 0:50
It looks like this stackoverflow post answers the question too. How to get iOS appStoreReceiptURL into Base 64 Encoded String
– Daniel Brower
Nov 21 at 0:48
It looks like this stackoverflow post answers the question too. How to get iOS appStoreReceiptURL into Base 64 Encoded String
– Daniel Brower
Nov 21 at 0:48
That’s great but a link is not an answer.
– matt
Nov 21 at 0:50
That’s great but a link is not an answer.
– matt
Nov 21 at 0:50
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53235869%2fhow-do-i-use-skreceiptrefreshrequest-to-restore-a-purchase-in-storekit-in-ios%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Show your actual code for creating the request and handling the response.
– rmaddy
Nov 10 at 5:05
@rmaddy I just added the code in the post above. I assumed that getting a request back in requestDidFinish with nil for receiptProperties means there is a receipt available.
– Daniel Brower
Nov 10 at 6:08
Show how you really create the
SKReceiptRefreshRequest
instance. Theinit
takes a parameter. And be sure you read the documentation forSKReceiptRefreshRequest
and itsinit
.– rmaddy
Nov 10 at 6:28
@rmaddy None of the states that make up the receiptProperties seemed to apply, so I didn't use any of the parameters. I used the code just as it says in the documentation I gave a link to in the post.
– Daniel Brower
Nov 10 at 6:45
@rmaddy Did I get this right? How do I distinguish the receipt for one product from the receipt of another product?
– Daniel Brower
Nov 20 at 3:32