<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/inAppPurchaseOptions(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP010_StoreKit_aB0E20inAppPurchaseOptionsyQrShy0dE07ProductV0H6OptionVGAHYacSgF"
  },
  "title" : "inAppPurchaseOptions(_:)"
}
-->

# inAppPurchaseOptions(_:)

Add a function to call before initiating a purchase from StoreKit view within this view, providing a set
of options for the purchase.

```
nonisolated func inAppPurchaseOptions(_ options: ((Product) async -> Set<Product.PurchaseOption>)?) -> some View
```

## Parameters

`options`

The system calls this function before processing a purchase, with the
product to  be purchased is provided as a parameter. Return a set of
purchase options to add to the purchase.

## Discussion

In-app stores within this view will add any default purchase options to the set you return, and use
the result for configuring the purchase. If you just want to react to in-app purchases beginning
without adding purchase options, you can add an action with
[`onInAppPurchaseStart(perform:)`](/documentation/SwiftUI/View/onInAppPurchaseStart(perform:)).

You can remove any options ancestor views may have added by providing `nil` for the action.
This will result in using the default set of purchase options.

---

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)