<!--
{
  "availability" : [
    "macOS: 15.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "StoreKit",
  "identifier" : "/documentation/StoreKit/AdvancedCommerceProduct/purchase(compactJWS:confirmIn:options:)-7x4bh",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "StoreKit"
    ],
    "preciseIdentifier" : "s:8StoreKit23AdvancedCommerceProductV8purchase10compactJWS9confirmIn7optionsAA0E0V14PurchaseResultOSS_So8NSWindowCShyAC0L6OptionVGtYaKF"
  },
  "title" : "purchase(compactJWS:confirmIn:options:)"
}
-->

# purchase(compactJWS:confirmIn:options:)

Processes a purchase for the product.

```
func purchase(compactJWS: String, confirmIn window: NSWindow, options: Set<AdvancedCommerceProduct.PurchaseOption> = []) async throws -> AdvancedCommerceProduct.PurchaseResult
```

## Parameters

`compactJWS`

The compact JSON Web Signature (JWS) string for the operation.

`window`

The window the system uses to display purchase confirmation UI in proximity to.

`options`

A set of purchase options.

## Return Value

The result of the purchase.

## Discussion

> Throws:
> A `PurchaseError`, `StoreKitError`, or `InvalidRequest` error.

---

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)