<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "StoreKit",
  "identifier" : "/documentation/StoreKit/Transaction/latest(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "StoreKit"
    ],
    "preciseIdentifier" : "s:8StoreKit11TransactionV6latest3forAA18VerificationResultOyACGSgSS_tYaFZ"
  },
  "title" : "latest(for:)"
}
-->

# latest(for:)

Gets the customer’s most recent transaction for an In-App Purchase.

```
static func latest(for productID: String) async -> VerificationResult<Transaction>?
```

## Parameters

`productID`

The product identifier that the method uses to look up the most recent transaction.

## Return Value

A [`VerificationResult`](/documentation/StoreKit/VerificationResult) with a single [`Transaction`](/documentation/StoreKit/Transaction), or `nil` if the customer hasn’t purchased the product.

## Discussion

Call this method for any type of In-App Purchase. The following code example illustrates requesting the most recent transaction to determine whether the customer purchased the product indicated by the string `productIdentifier`:

```swift
guard let verificationResult = await Transaction.latest(for: productIdentifier) else {    
    // The customer hasn't purchased this product.
    return
}

switch verificationResult {
case .verified(let transaction):
    // Check the transaction and give the customer access to purchased 
    // content as appropriate.
    ...
case .unverified(let transaction, let verificationError):
    // Handle unverified transactions based 
    // on your business model.
    ...
}
```

By default, when the <doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/SKIncludeConsumableInAppPurchaseHistory> property list key is `false`, this method excludes finished consumable in-app purchases unless they are refunded or revoked.

If you set the <doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/SKIncludeConsumableInAppPurchaseHistory> property list key to `true`, this method returns all transactions, including consumable In-App Purchases that your app marked as finished ([`finish()`](/documentation/StoreKit/Transaction/finish())).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)