-
Notifications
You must be signed in to change notification settings - Fork 795
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
SwiftyStoreKit.refreshReceipt() should not be removed #223
Comments
Yep. I didn't found this method in new version. |
@hlung @vovkasmprigarin Currently, the receipt is refreshed automatically if it's missing when you call The intention is to let SwiftyStoreKit handle this for you. Rather than restoring the old
This way, SwiftyStoreKit will first refresh the receipt, then use it with your Makes sense? |
@bizz84 No. I send receipt data to my server for validation. |
@bizz84 Yes it make sense if i let apple validate receipt for me. But my app does validation on server (need to send actual receipt data). Calling SKRefreshReceipt request is troblesome because of the delegate pattern. Having SwiftyStoreKit handle this with callback closure is much easier to use ;) |
@vovkasmprigarin @hlung If you use However, you don't have to. You can write your own validator that takes the receipt data as a string, and posts it to your own server. Example: class CustomReceiptValidator: ReceiptValidator {
func validate(receipt: String, password autoRenewPassword: String?, completion: @escaping (VerifyReceiptResult) -> Void) {
// encode string, send to your own server, call completion when processed.
}
} You can then call let customValidator = CustomReceiptValidator()
SwiftyStoreKit.verifyReceipt(using: customValidator, password: "your-shared-secret") { result in
switch result {
case .success(let receipt):
// Verify the purchase of Consumable or NonConsumable
case .error(let error):
// Handle error
}
} I can add a |
@vovkasmprigarin I have opened #224 to add a If you already have a local receipt and you change the Apple ID, are you sure the app doesn't update the receipt automatically? |
This is now implemented and available on version 0.10.3. Closing the issue for now. Feel free to ask more questions if needed. |
@bizz84 yep. If you change the AppleID, the Receipt doesn't update automatically:( CustomReceiptValidator send data to apple server to validate. It's not correct for me. I send receiptData to my server, and after then server send receiptData to Apple server for validation. force update may be will help for people, but will not for me:( Ok. I will use last pod version with refresh receipt function. Thanks for your answers :) |
@vovkasmprigarin To clarify, I am proposing to write your own custom validator to post data to your server. See my answer above. |
In my case, I need to pass user id to my backend. Since I think I can just create a SKReceiptRefreshRequest wrapper. May be pull some code from InAppReceiptRefreshRequest. Will share my code later. ;) |
We also need to only verify receipt at server, so the old refreshReceipt is much more handy than implement a custom class for that job. We believe it's a common case. Anyway, why do we need to use a SwiftyStoreKit if everything need to be a new class and delegate? Apple's Storekit will just be fine. |
@hlung I think passing any custom data to your @vxst You own the logic for receipt verification with your server, so it makes sense to implement it in a class and pass it to SwiftyStoreKit.
I see that a few people seem confused by this. Is the documentation not clear? |
Platform
In app purchase type
Environment
Version
ℹ Please replace this with the version of SwiftyStoreKit you're using.
10.1
Report
This pull request #213 removed
SwiftyStoreKit.refreshReceipt()
. But I need it for refreshing receipt and send it to my server for validation. I think it is a valid use case.The text was updated successfully, but these errors were encountered: