-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Use case
The swift code for purchasing an item with StoreKit2 is as follows,
The app developer must reference the contents of the transaction variable.
// https://developer.apple.com/documentation/storekit/product/purchaseresult
let result = try await product.purchase()
switch result {
case .success(let verificationResult):
switch verificationResult {
case .verified(let transaction):
// Give the user access to purchased content.
...
// Complete the transaction after providing
// the user access to the content.
await transaction.finish()
...
}
case .pending:
// The purchase requires action from the customer.
// If the transaction completes,
// it's available through Transaction.updates.
break
case .userCancelled:
// The user canceled the purchase.
break
@unknown default:
break
}
Specifically I need the jwsRepresentation property of the transaction to see the purchase information on the app server.
The current in_app_purchase library does not have an interface to get it.
https://developer.apple.com/documentation/storekit/verificationresult/jwsrepresentation-21vgo
https://github.com/search?q=repo%3Aflutter%2Fpackages%20jwsRepresentation&type=code
For some reason it is only used in the restorePurchases method, but it is not possible to get the value of jwsRepresentation during a normal purchase.