VerificationResult
A type that describes the result of a StoreKit verification.
Declaration
@frozen enum VerificationResult<SignedType>Overview
StoreKit automatically verifies the Transaction, Product.SubscriptionInfo.RenewalInfo, and AppTransaction values. To access the wrapped values, check whether the values are verified or unverified.
In addition to getting a verification result from StoreKit, you might want to verify the signed information yourself, either on the device, or on your server for the most control and security. Perform the verification on the jwsRepresentation property for subscription renewal information, the jwsRepresentation property for transactions, and the jwsRepresentation property for an app transaction.
To verify the jwsRepresentation on your server, consider using the verification functions in the App Store Server Library. The library provides the functions verifyAndDecodeTransaction, verifyAndDecodeAppTransaction, and verifyAndDecodeRenewalInfo in each language the library supports. For more information, see Simplifying your implementation by using the App Store Server Library.
The jwsRepresentation string is in JWS Compact Serialization format and is the same as its counterpart in the App Store server APIs, as follows:
StoreKit string | Equivalent in the App Store Server API | Equivalent in App Store Server Notifications |
|---|---|---|
Jwsrepresentation 178oj for subscription renewal information | ||
Jwsrepresentation 21vgo for transactions |
The decoded payload of the jwsRepresentation contains two additional fields: deviceVerification and deviceVerificationNonce. Use these fields on the device to verify that JWS information belongs to the device. For more information, see deviceVerificationID.
Topics
Getting the verification results
VerificationResult.verified(_:)VerificationResult.unverified(_:_:)payloadValueunsafePayloadValueVerificationResult.VerificationError
Getting properties for transactions
jwsRepresentationdeviceVerificationdeviceVerificationNoncesignedDateheaderDatapayloadDatasignedDatasignatureDatasignature
Getting properties for subscription renewal information
jwsRepresentationdeviceVerificationdeviceVerificationNoncesignedDateheaderDatapayloadDatasignedDatasignatureDatasignature