-
Notifications
You must be signed in to change notification settings - Fork 796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please consider move back *refreshReceipt* #272
Comments
Oh... we was already ask about this in the 223 issue. But author don't want move back refreshReceipt method. It's so sad :( |
Apologies for the late reply. If you want to do receipt validation on your server, // Implement MyCustomReceiptValidator to send the encrypted receipt data to your server
let validator = MyCustomReceiptValidator(service: .production)
SwiftyStoreKit.verifyReceipt(using: validator, password: "your-shared-secret", forceRefresh: false) { result in
switch result {
case .success(let receipt):
print("Verify receipt Success: \(receipt)")
case .error(let error):
print("Verify receipt Failed: \(error)")
}
} If you want to send the plain text receipt data to your server instead, but keep the default let appleValidator = AppleReceiptValidator(service: .production)
SwiftyStoreKit.verifyReceipt(using: appleValidator, password: "your-shared-secret", forceRefresh: false) { result in
switch result {
case .success(let receipt):
// send plain text receipt to server
case .error(let error):
print("Verify receipt Failed: \(error)")
}
} In both cases, Makes sense? |
No it’s not make sense
…On Tue, Oct 10, 2017 at 7:06 PM Andrea Bizzotto ***@***.***> wrote:
Apologies for the late reply.
If you want to do *receipt validation* on your server, verifyReceipt
<https://github.com/bizz84/SwiftyStoreKit#verify-receipt> is your friend
and you can use it like this:
// Implement MyCustomReceiptValidator to send the encrypted receipt data to your serverlet validator = MyCustomReceiptValidator(service: .production)
SwiftyStoreKit.verifyReceipt(using: validator, password: "your-shared-secret", forceRefresh: false) { result in
switch result {
case .success(let receipt):
print("Verify receipt Success: \(receipt)")
case .error(let error):
print("Verify receipt Failed: \(error)")
}
}
If you want to send the plain text receipt data to your server instead,
but keep the default AppleReceiptValidator for decryption, you can do
this:
let appleValidator = AppleReceiptValidator(service: .production)
SwiftyStoreKit.verifyReceipt(using: appleValidator, password: "your-shared-secret", forceRefresh: false) { result in
switch result {
case .success(let receipt):
// send plain text receipt to server case .error(let error):
print("Verify receipt Failed: \(error)")
}
}
In both cases, refreshReceipt is not strictly needed. You can use forceRefresh:
true if desired.
Makes sense?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#272 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABOOA4l7I24DuosqVaASS3aCs3d1UcFdks5sq13igaJpZM4PdW-V>
.
|
I agree with itleo31. |
@bizz84 : We just need to load the receipt data and upload to server. Server will do all logic like verify receipt and update models and other stuffs. On client, this process is not verify receipt. So we just need "loadReceipt" only. |
@itleo31 I think I understand now, apologies or the confusion. So basically you want access to the Ok, I will implement this. My idea is to add a new method: func fetchReceipt(forceRefresh: Bool, completion: (receipt: String) -> Void))
This way, you can then send the encrypted receipt to your server for processing. Would this work for you? |
Ya that will be great. Thank you very much. |
Cool. Will do this now, should be available today. |
@itleo31 This is now implemented in #278 in case you want to give it a quick test. Will be doing a bit more cleanup and publish a new version soon. |
@itleo31 do you think it makes more sense to return the receipt as Currently all receipt verification methods use |
@bizz84 I would return as Data. That way it will match to localReceiptData. |
@bizz84 why you didn't do this 4 month ago?? (issue 223) P.S. thx. |
@shuhrat10 RE string vs data, done in #284. @vovkaprigarin Apologies, I did not understand the problem clearly back then. |
@bizz84 : Same with @shuhrat10 , I think return Data is good. Can I close this issue? |
@itleo31 the fix is currently on develop. I'm waiting for CI to finish on a separate PR, merge, and publish a new pod version. Feel free to close it. |
@bizz84 can you release new pod with this changes? |
@shuhrat10 I've been trying to but I'm having problems with it. See #285. Any ideas? For the time being, you can point your pod to |
Version 0.11.0 has been published with this fix. |
Please consider move back refreshReceipt |
Platform
In app purchase type
Environment
Version
ℹ 4.0.0
Related issues
ℹ N/A.
Report
Issue summary
ℹ I'm migrating from version 3 to 4 and found the API removed the method refreshReceipt. My app handles the verification flow on server. So in the client, I need to retrieve the receiptData and post to my server. So I called refreshReceipt before upload it to server to make sure it is the latest but now it's not available anymore. I know I can workaround by just upload the localReceipt, but I'm not sure it is latest or not. Please advise.
What did you expect to happen
ℹ Migrate from version 3 to 4
What happened instead
ℹ Need refreshReceipt method.
The text was updated successfully, but these errors were encountered: