<!--
{
  "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/SKTestTransaction",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "StoreKit Test"
    ],
    "preciseIdentifier" : "c:objc(cs)SKTestTransaction"
  },
  "title" : "SKTestTransaction"
}
-->

# SKTestTransaction

A transaction that occurs in the testing environment.

```
class SKTestTransaction
```

## Overview

The test transaction represents the test environment’s knowledge of the transaction, including its identifier and the transaction’s state. It represents all the transaction-related configurations you control manually in Xcode for interrupted purchases, Ask to Buy scenarios, and changes to a subscription’s auto-renew state.

The test environment creates an `SKTestTransaction` instance each time your test code calls any method of [`SKTestSession`](/documentation/StoreKitTest/SKTestSession) that affects in-app purchases.

## Topics

### Identifying Transactions and Products

[`identifier`](/documentation/StoreKitTest/SKTestTransaction/identifier)

The identifier of the transaction in the testing environment.

[`originalTransactionIdentifier`](/documentation/StoreKitTest/SKTestTransaction/originalTransactionIdentifier)

The identifier of the original transaction.

[`productIdentifier`](/documentation/StoreKitTest/SKTestTransaction/productIdentifier)

An identifier that uniquely represents a product, which you provide in the StoreKit configuration file.

### Getting Payment Transaction States

[`state`](/documentation/StoreKitTest/SKTestTransaction/state)

The state of the transaction in the test environment.

### Getting Dates

[`purchaseDate`](/documentation/StoreKitTest/SKTestTransaction/purchaseDate)

The date of purchase for the transaction.

[`cancelDate`](/documentation/StoreKitTest/SKTestTransaction/cancelDate)

The date when the system refunded the transaction.

[`expirationDate`](/documentation/StoreKitTest/SKTestTransaction/expirationDate)

The date a subscription expires.

### Getting Test Environment States

[`autoRenewingEnabled`](/documentation/StoreKitTest/SKTestTransaction/autoRenewingEnabled)

A Boolean value that indicates whether automatic renewal is enabled for the subscription.

[`hasPurchaseIssue`](/documentation/StoreKitTest/SKTestTransaction/hasPurchaseIssue)

A Boolean value that indicates whether you resolve this transaction using the test framework functions.

[`pendingPriceIncreaseConsent`](/documentation/StoreKitTest/SKTestTransaction/isPendingPriceIncreaseConsent)

A Boolean value that indicates whether the auto-renewable subscription has a price increase that’s awaiting user consent in the test environment.

[`pendingAskToBuyConfirmation`](/documentation/StoreKitTest/SKTestTransaction/pendingAskToBuyConfirmation)

A Boolean value that indicates whether the transaction is awaiting an Ask to Buy confirmation.

## Relationships

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)