---
title: askToBuyEnabled
framework: storekittest
role: symbol
role_heading: Instance Property
path: storekittest/sktestsession/asktobuyenabled
---

# askToBuyEnabled

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

## Declaration

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

## Discussion

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:), and to decline it, call declineAskToBuyTransaction(identifier:). Changing this property overrides its setting in the StoreKit configuration file for this test session. Call resetToDefaultState() to revert all settings to those in the configuration file.

## See Also

### Testing Ask To Buy transactions

- [approveAskToBuyTransaction(identifier:)](storekittest/sktestsession/approveasktobuytransaction(identifier:).md)
- [declineAskToBuyTransaction(identifier:)](storekittest/sktestsession/declineasktobuytransaction(identifier:).md)
