<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "StoreKitTest",
  "identifier" : "/documentation/StoreKitTest/SKTestSession/askToBuyEnabled",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "StoreKit Test"
    ],
    "preciseIdentifier" : "c:objc(cs)SKTestSession(py)askToBuyEnabled"
  },
  "title" : "askToBuyEnabled"
}
-->

# askToBuyEnabled

A Boolean value that determines whether the testing environment simulates an Ask to Buy scenario.

```
var askToBuyEnabled: Bool { get set }
```

## Discussion

The default value is `false`. Enabling this property causes all purchases to require approval until you disable it. To approve the purchase in the testing environment, call [`approveAskToBuyTransaction(identifier:)`](/documentation/StoreKitTest/SKTestSession/approveAskToBuyTransaction(identifier:)), and to decline it, call [`declineAskToBuyTransaction(identifier:)`](/documentation/StoreKitTest/SKTestSession/declineAskToBuyTransaction(identifier:)).

Changing this property overrides its setting in the StoreKit configuration file for this test session. Call [`resetToDefaultState()`](/documentation/StoreKitTest/SKTestSession/resetToDefaultState()) to revert all settings to those in the configuration file.

---

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)