verifyReceipt in storekit v2

Hi,

Currently we are using store kit api and we get the receipt which then backend validate from apple using /verifyReceipt.
Now we are planning to move to store kit v2 api. But in this case, we are getting signedPayload instead of receipt. Now this signedPayload cannot be used in the /verifyReceipt. So what is the other way to validate the signedToken from apple and get the data that we get from the /verifyReceipt response.
Thanks for the help!

With StoreKit you have the ability to do this all locally. But you can use the App Store Server API for various actions using a purchases Original transaction ID. https://developer.apple.com/documentation/appstoreserverapi

Also check out our sessions discussing the transition to StoreKit and App Store server API https://developer.apple.com/videos/play/wwdc2021/10114 https://developer.apple.com/videos/play/tech-talks/10887/

@shashank-sachan did you find a way to communicate to your servers that a purchases has been verified locally? I see that the server verification in StoreKit 2 needs to receive the transaction ID from the client. And then store this transaction ID in the DB, to be able to later on communicate server-to-server with Apple. The receipt which was retrieved with Bundle(for: Self.self).appStoreReceiptURL in StoreKit 1 is not longer necessary for StoreKit 2. I am watching this video https://developer.apple.com/videos/play/tech-talks/10887/

IS THIS ALSO YOUR UNDERSTANDING?

Hi,

verifyReceipt is deprecated. You should use jwsRepresentation of success purchase result

switch try await product.purchase() {
case .success(let result):
    let jws = result.jwsRepresentation
    // send jws to your backend

And check it on your backend. For more details try to google article "How to Validate iOS and macOS In-App Purchases Using StoreKit 2 and Server-Side Swift". It's very useful.

verifyReceipt in storekit v2
 
 
Q