Skip to content

[in_app_purchase][iOS] Unable to get VerificationResult value for StoreKit2 #164433

@fushihara

Description

@fushihara

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listp: in_app_purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions