One Logo Pool Ball
StoreKit · IOS API REFERENCE

Transaction

struct · iOS 15.0+ · SDK 27.1

struct Transaction

Represents signed transaction information for a purchase.

Members (59)

get · iOS 15.0+

bundleOriginalTransactionID

TypeScript
get bundleOriginalTransactionID(): (string) | null
Swift declaration
@backDeployed(before: iOS 27.0, macOS 27.0, tvOS 27.0, watchOS 27.0, visionOS 27.0)
var bundleOriginalTransactionID: String? { get }
get · iOS 15.0+

previousOriginalTransactionID

TypeScript
get previousOriginalTransactionID(): (number) | null
Swift declaration
@backDeployed(before: iOS 27.0, macOS 27.0, tvOS 27.0, watchOS 27.0, visionOS 27.0)
var previousOriginalTransactionID: UInt64? { get }

The original transaction ID of the subscription this one replaced when a customer switched between a standalone auto-renewable subscription and a subscription bundle (in either direction). For a bundle transaction, this is the standalone subscription's original transaction ID, while for a standalone transaction, this is the bundle's original transaction ID. This field is `nil` if no such switch occurred.

get · iOS 15.0+

appTransactionID

TypeScript
get appTransactionID(): string
Swift declaration
@backDeployed(before: iOS 18.4, macOS 15.4, tvOS 18.4, watchOS 11.4, visionOS 2.4)
var appTransactionID: String { get }
get · iOS 15.0+

bundleTransactionID

TypeScript
get bundleTransactionID(): (string) | null
Swift declaration
@backDeployed(before: iOS 27.0, macOS 27.0, tvOS 27.0, watchOS 27.0, visionOS 27.0)
var bundleTransactionID: String? { get }
get · iOS 15.0+

isUpgraded

TypeScript
get isUpgraded(): boolean
Swift declaration
let isUpgraded: Bool

If this transaction was upgraded to a subscription with a higher level of service. - Important: If this property is `true`, look for a new transaction for a subscription with a higher level of service. - Note: Only for subscriptions.

get · iOS 15.0+

originalID

TypeScript
get originalID(): number
Swift declaration
let originalID: UInt64

The ID of the original transaction for `productID` or`subscriptionGroupID` if this is a subscription.

get · iOS 15.0+

signedDate

TypeScript
get signedDate(): globalThis.Date
Swift declaration
let signedDate: Date

The date this transaction was generated and signed.

get · iOS 17.0+

storefront

TypeScript
get storefront(): Storefront
Swift declaration
let storefront: Storefront

The `Storefront` the transaction was completed in.

get · iOS 15.0+

unfinished

TypeScript
static get unfinished(): Transaction_Transactions
Swift declaration
static var unfinished: Transaction.Transactions { get }

A sequence of every unfinished transaction for this user and app.

get · iOS 15.0+

appBundleID

TypeScript
get appBundleID(): string
Swift declaration
let appBundleID: String

Identifies the application the transaction is for.

get · iOS 16.0+

environment

TypeScript
get environment(): AppStore_Environment
Swift declaration
let environment: AppStore.Environment

The server environment the transaction was created in.

get · iOS 15.0+

productType

TypeScript
get productType(): Product_ProductType
Swift declaration
let productType: Product.ProductType

The type of `productID`.

get · iOS 15.0+ · Deprecated in iOS 16.0

currencyCode

TypeScript
get currencyCode(): (string) | null
Swift declaration
@backDeployed(before: iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0)
var currencyCode: String? { get }

ISO3A code for the currency used for the purchase. - Important: The property may return a `nil` value in some uncommon cases: (1) The price is also `nil`, (2) StoreKit Testing in Xcode (workaround: test your app on a device running a more recent OS) or (3) a critical server error. @DeprecationSummary { Use the ``currency`` property instead. }

get · iOS 15.0+

purchaseDate

TypeScript
get purchaseDate(): globalThis.Date
Swift declaration
let purchaseDate: Date

The date this transaction occurred on.

get · iOS 15.0+

ownershipType

TypeScript
get ownershipType(): Transaction_OwnershipType
Swift declaration
let ownershipType: Transaction.OwnershipType

Whether the user purchased this transaction, or has access to it via family sharing.

get · iOS 26.4+

commitmentInfo

TypeScript
get commitmentInfo(): (Transaction_CommitmentInfo) | null
Swift declaration
let commitmentInfo: Transaction.CommitmentInfo?
get · iOS 15.0+

expirationDate

TypeScript
get expirationDate(): (globalThis.Date) | null
Swift declaration
let expirationDate: Date?

The date the users access to `productID` expires - Note: Only for subscriptions.

get · iOS 15.0+

revocationDate

TypeScript
get revocationDate(): (globalThis.Date) | null
Swift declaration
let revocationDate: Date?

The date the transaction was revoked, or `nil` if it was not revoked.

get · iOS 26.4+

revocationType

TypeScript
get revocationType(): (Transaction_RevocationType) | null
Swift declaration
let revocationType: Transaction.RevocationType?

The type of refund or revocation that applies to the transaction. This property indicates whether the transaction has a full refund, a prorated refund, or is revoked from Family Sharing. This property is `nil` for transactions that are not revoked. - Note: This property is not present for Advanced Commerce transactions, which use ``AdvancedCommerceInfo/Item/refunds`` instead.

get · iOS 15.0+

appAccountToken

TypeScript
get appAccountToken(): (string) | null
Swift declaration
let appAccountToken: UUID?

If an app account token was added as a purchase option when purchasing, this property will be the token provided. If no token was provided, this will be `nil`.

get · iOS 26.4+

billingPlanType

TypeScript
get billingPlanType(): (Product_SubscriptionInfo_BillingPlanType) | null
Swift declaration
let billingPlanType: SubscriptionInfo.BillingPlanType?
get · iOS 15.0+

bundleProductID

TypeScript
get bundleProductID(): (string) | null
Swift declaration
@backDeployed(before: iOS 27.0, macOS 27.0, tvOS 27.0, watchOS 27.0, visionOS 27.0)
var bundleProductID: String? { get }

Identifies the bundle product the transaction is for. If this transaction is created as a result of a subscription bundle purchase or renewal, this field will be populated with the product ID of the bundle.

get · iOS 15.0+

debugDescription

TypeScript
get debugDescription(): string
Swift declaration
var debugDescription: String { get }

A textual representation of this instance, suitable for debugging. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(reflecting:)` initializer. This initializer works with any type, and uses the custom `debugDescription` property for types that conform to `CustomDebugStringConvertible`: struct Point: CustomDebugStringConvertible { let x: Int, y: Int var debugDescription: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(reflecting: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `debugDescription` property.

get · iOS 15.0+

revocationReason

TypeScript
get revocationReason(): (Transaction_RevocationReason) | null
Swift declaration
let revocationReason: Transaction.RevocationReason?

The reason the transaction was revoked, or `nil` if it was not revoked.

get · iOS 15.0+

purchasedQuantity

TypeScript
get purchasedQuantity(): number
Swift declaration
let purchasedQuantity: Int

Quantity of `productID` purchased in the transaction. - Note: Always 1 for non-consumables and auto-renewable suscriptions.

method · iOS 15.0+

beginRefundRequest

TypeScript
beginRefundRequestIn(scene: _UIKit_UIWindowScene): Promise<Transaction_RefundRequestStatus>
Swift declaration
func beginRefundRequest(in scene: UIWindowScene) async throws -> Transaction.RefundRequestStatus

Display the refund request sheet for this transaction. - Parameter scene: The window scene to present the refund request sheet in. - Returns: The result of the refund request. - Throws: `RefundRequestError` or `StoreKitError`.

static · iOS 15.0+

beginRefundRequest

TypeScript
static beginRefundRequestForIn(transactionID: number, scene: _UIKit_UIWindowScene): Promise<Transaction_RefundRequestStatus>
Swift declaration
@MainActor static func beginRefundRequest(for transactionID: UInt64, in scene: UIWindowScene) async throws -> Transaction.RefundRequestStatus

Display the refund request sheet. - Parameters: - transactionID: The transaction ID to request a refund for. - scene: The window scene to present the refund request sheet in. - Returns: The result of the refund request. - Throws: `RefundRequestError` or `StoreKitError`.

static · iOS 15.0+ · Deprecated in iOS 18.4

currentEntitlement

TypeScript
static currentEntitlement(productID: string): Promise<(VerificationResult<Transaction>) | null>
Swift declaration
static func currentEntitlement(for productID: String) async -> VerificationResult<Transaction>?

Get the transaction that entitles the user to a product. - Parameter productID: Identifies the product to check entitlements for. - Returns: A transaction if the user is entitled to the product, or `nil` if they are not. @DeprecationSummary { Use ``currentEntitlements(for:)`` method instead. }

get · iOS 15.0+

deviceVerification

TypeScript
get deviceVerification(): ArrayBuffer
Swift declaration
let deviceVerification: Data

A SHA-384 hash of `AppStore.deviceVerificationID` appended after `deviceVerificationNonce` (both lowercased UUID strings).

get · iOS 15.0+

jsonRepresentation

TypeScript
get jsonRepresentation(): ArrayBuffer
Swift declaration
var jsonRepresentation: Data { get }

The JSON representation of the transaction.

get · iOS 15.0+

subscriptionStatus

TypeScript
get subscriptionStatus(): Promise<(Product_SubscriptionInfo_Status) | null>
Swift declaration
@backDeployed(before: iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0)
var subscriptionStatus: Product.SubscriptionInfo.Status? { get async }

The full subscription status for the transaction. If the transaction is not for a subscription (i.e. ``Transaction/productType`` is not ``Product/ProductType/autoRenewable``), the value will always be `nil`. The value may be `nil` if there is an error retrieving the subscription status. - Note: The value's ``Product/SubscriptionInfo/Status/transaction`` property represents the latest transaction for the subscription, which is not necessarily the same as this transaction.

get · iOS 15.0+

webOrderLineItemID

TypeScript
get webOrderLineItemID(): (string) | null
Swift declaration
let webOrderLineItemID: String?

Uniquely identifies a subscription purchase. - Note: Only for subscriptions.

static · iOS 18.4+

currentEntitlements

TypeScript
static currentEntitlementsFor(productID: string): Transaction_Transactions
Swift declaration
static func currentEntitlements(for productID: String) -> Transaction.Transactions

Gets the transactions that entitle the user to items purchased under a product ID. If a generic SKU is provided, the returned sequence will yield all transactions that entitle the user to Advanced Commerce Items purchased using the generic product's ID. If an ID for a regular IAP is provided, the returned sequence will contain no more than one transaction. - Parameter productID: Identifies the product to check entitlements for. - Returns: A sequence containing all transactions that entitle the user to the product.

get · iOS 15.0+

currentEntitlements

TypeScript
static get currentEntitlements(): Transaction_Transactions
Swift declaration
static var currentEntitlements: Transaction.Transactions { get }

Returns all transactions for products the user is currently entitled to i.e. all currently-subscribed transactions, and all purchased (and not refunded) non-consumables

get · iOS 15.0+

subscriptionGroupID

TypeScript
get subscriptionGroupID(): (string) | null
Swift declaration
let subscriptionGroupID: String?

Identifies the subscription group the transaction is for. - Note: Only for subscriptions.

get · iOS 18.4+

advancedCommerceInfo

TypeScript
get advancedCommerceInfo(): (Transaction_AdvancedCommerceInfo) | null
Swift declaration
let advancedCommerceInfo: Transaction.AdvancedCommerceInfo?

Metadata specific to Advanced Commerce.

get · iOS 15.0+

originalPurchaseDate

TypeScript
get originalPurchaseDate(): globalThis.Date
Swift declaration
let originalPurchaseDate: Date

The date the original transaction for `productID` or`subscriptionGroupID` occurred on.

get · iOS 15.0+

revocationPercentage

TypeScript
get revocationPercentage(): (_Foundation_Decimal) | null
Swift declaration
@backDeployed(before: iOS 26.4, macOS 26.4, tvOS 26.4, watchOS 26.4, visionOS 26.4)
var revocationPercentage: Decimal? { get }

The percentage of the transaction amount that the App Store has refunded or revoked, expressed as a decimal. This property indicates the rounded percentage of the purchase amount that the App Store has refunded or revoked. The value is present only for transactions with a non-reversed refund. Valid values range from 0.0 to 100.0: - For auto-renewable subscriptions: 0.0-100.0% based on time remaining in the subscription period - For consumables, non-consumables, and non-renewing subscriptions: 0.0-100.0% based on consumption data If the purchase had a quantity greater than 1, this percentage applies to the full quantity. For example, if 1 of 3 items was refunded, the value would be approximately 33.333. The following table shows several examples of revocation percentages, and their milliunit equivalents: | Percentage | Integer equivalent, in milliunits | |-----------|---------------------------| | 67.932% | 67932 | | 0.015% | 15 | | 40% | 40000 | | 100% | 100000| * - Note: This property is not present for Advanced Commerce transactions, which use ``AdvancedCommerceInfo/Refund/amount`` instead.

get · iOS 15.0+

storefrontCountryCode

TypeScript
get storefrontCountryCode(): string
Swift declaration
@backDeployed(before: iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, macCatalyst 17.0)
var storefrontCountryCode: String { get }

The ISO alpha-3 country code of the `Storefront` the transaction was completed in. - Important: When using `storefrontCountryCode` on systems earlier than iOS 17.0, macOS 14.0, tvOS 17.0 or watchOS 10.0, the property may return a sentinel empty string in some uncommon cases: (1) StoreKit Testing in Xcode (workaround: test your app on a device running a more recent OS) or (2) a critical server error. If possible, use the ``Transaction/storefront`` property to guarantee a valid value. @DeprecationSummary { Use the ``storefront`` property instead. } @available(iOS, introduced: 15.0, deprecated: 17.0, message: "Use the storefront property instead")

get · iOS 15.0+

deviceVerificationNonce

TypeScript
get deviceVerificationNonce(): string
Swift declaration
let deviceVerificationNonce: UUID

The nonce used when computing `deviceVerification`. - SeeAlso: `AppStore.deviceVerificationID`

get · iOS 15.0+

bundleSubscriptionGroupID

TypeScript
get bundleSubscriptionGroupID(): (string) | null
Swift declaration
@backDeployed(before: iOS 27.0, macOS 27.0, tvOS 27.0, watchOS 27.0, visionOS 27.0)
var bundleSubscriptionGroupID: String? { get }

Identifies the subscription bundle group the transaction is for. - Note: Only for transactions of subscriptions included in a bundle.

get · iOS 15.0+ · Deprecated in iOS 17.0

reasonStringRepresentation

TypeScript
get reasonStringRepresentation(): string
Swift declaration
@backDeployed(before: iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, macCatalyst 17.0)
var reasonStringRepresentation: String { get }

The reason for the transaction. The possible values this can return are "PURCHASE" when a transaction is the result of a change of service, or "RENEWAL" when a transaction is the result of a subscription renewing. - Important: When using `reasonStringRepresentation` on systems earlier than iOS 17.0, macOS 14.0, tvOS 17.0 or watchOS 10.0, the property may return a sentinel string equal to "PURCHASE" in some uncommon cases: (1) StoreKit Testing in Xcode (workaround: test your app on a device running a more recent OS) or (2) a critical server error. If possible, use the ``Transaction/reason`` property to guarantee a valid value.

get · iOS 15.0+

id

TypeScript
get id(): number
Swift declaration
let id: UInt64

Unique ID for the transaction.

get · iOS 15.0+ · Deprecated in iOS 16.0

environmentStringRepresentation

TypeScript
get environmentStringRepresentation(): string
Swift declaration
@backDeployed(before: iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, macCatalyst 16.0)
var environmentStringRepresentation: String { get }

The server environment the transaction was created in. The possible values this can return are "Production" for apps downloaded from the App Store, "Sandbox" for the App Store Sandbox and apps downloaded from TestFlight, and "Xcode" for StoreKit Testing in Xcode. - Important: The property may return a sentinel empty string in some uncommon cases: (1) StoreKit Testing in Xcode (workaround: test your app on a device running a more recent OS) or (2) a critical server error. If possible, use the ``Transaction/environment`` property to guarantee a valid value. @DeprecationSummary { Use the ``environment`` property instead. }

get · iOS 15.0+ · Deprecated in iOS 18.4

offerPeriodStringRepresentation

TypeScript
get offerPeriodStringRepresentation(): (string) | null
Swift declaration
@backDeployed(before: iOS 18.4, macOS 15.4, tvOS 18.4, watchOS 11.4, visionOS 2.4)
var offerPeriodStringRepresentation: String? { get }

The string representation of the offer period applied to the subscription offer for this transaction. - Note: Only for subscriptions and when there is an `offer`. - Important: The property may return a sentinel nil value in some uncommon cases: (1) StoreKit Testing in Xcode (workaround: test your app on a device running a more recent OS), or (2) a critical server error. @DeprecationSummary { Use the ``offer`` property instead. }

get · iOS 15.0+ · Deprecated in iOS 26.4

revocationTypeStringRepresentation

TypeScript
get revocationTypeStringRepresentation(): (string) | null
Swift declaration
@backDeployed(before: iOS 26.4, macOS 26.4, tvOS 26.4, watchOS 26.4, visionOS 26.4)
var revocationTypeStringRepresentation: String? { get }

The string representation of the ``revocationType``, or `nil` if the transaction was not revoked. @DeprecationSummary { Use the ``revocationType`` property instead. }

get · iOS 15.0+ · Deprecated in iOS 17.2

offerPaymentModeStringRepresentation

TypeScript
get offerPaymentModeStringRepresentation(): (string) | null
Swift declaration
@backDeployed(before: iOS 17.2, macOS 14.2, tvOS 17.2, watchOS 10.2)
var offerPaymentModeStringRepresentation: String? { get }

The string representation of the payment mode applied to the subscription offer for this transaction. - Note: Only for subscriptions and when there is an `offer`. The payment mode may be unknown for transactions created before the release of App Store Server API 1.10. If the payment mode is unknown, the property is nil. - Important: The property may return a sentinel nil value in some uncommon cases: (1) StoreKit Testing in Xcode (workaround: test your app on a device running a more recent OS), or (2) a critical server error. @DeprecationSummary { Use the ``offer`` property instead. }

static · iOS 18.4+

all

TypeScript
static allFor(productID: string): Transaction_Transactions
Swift declaration
static func all(for productID: String) -> Transaction.Transactions

Gets all the transactions associated with this product ID. - Parameter productID: Identifies the product to filter the transaction cache against. - Returns: A sequence containing all transactions for the given product.

get · iOS 15.0+

all

TypeScript
static get all(): Transaction_Transactions
Swift declaration
static var all: Transaction.Transactions { get }

A sequence of every transaction for this user and app.

get · iOS 17.2+

offer

TypeScript
get offer(): (Transaction_Offer) | null
Swift declaration
let offer: Transaction.Offer?

The offer applied to this transaction. - Note: Only for subscriptions.

get · iOS 15.0+

price

TypeScript
get price(): (_Foundation_Decimal) | null
Swift declaration
@backDeployed(before: iOS 17.2, macOS 14.2, tvOS 17.2, watchOS 10.2, visionOS 1.1)
var price: Decimal? { get }

Amount charged to the customer when purchasing this offer. - Important: The property may return a `nil` value in some uncommon cases: (1) StoreKit Testing in Xcode (workaround: test your app on a device running a more recent OS) or (2) a critical server error.

method · iOS 15.0+

finish

TypeScript
finish(): Promise<void>
Swift declaration
func finish() async

Call this method after giving the user access to `productID`.

static · iOS 15.0+

latest

TypeScript
static latest(productID: string): Promise<(VerificationResult<Transaction>) | null>
Swift declaration
static func latest(for productID: String) async -> VerificationResult<Transaction>?

The user's latest transaction for a product. - Parameter productID: Identifies the product to check entitlements for. - Returns: A verified transaction, or `nil` if the user has never purchased this product.

get · iOS 17.0+

reason

TypeScript
get reason(): Transaction_Reason
Swift declaration
let reason: Transaction.Reason

The reason for the transaction.

get · iOS 15.0+ · Deprecated in iOS 17.2

offerID

TypeScript
get offerID(): (string) | null
Swift declaration
var offerID: String? { get }

Identifies the offer applied to this transaction for `promotional` and `code` offer types. If `offerType` is `promotional`, this will be the offer identifier. If `offerType` is `code`, this will be the offer code reference name. This will be `nil` for `introductory` offers and if there is no offer applied. - Note: Only for subscriptions. @DeprecationSummary { Use the ``offer`` property instead. }

get · iOS 15.0+

updates

TypeScript
static get updates(): Transaction_Transactions
Swift declaration
static var updates: Transaction.Transactions { get }

A sequence that emits a transaction each time it is created or updated. - Important: Create a `Task` to iterate this sequence as early as possible when your app launches. This is important, for example, to handle transactions that may have occured after `purchase` returns, like an adult approving a child's purchase request or a purchase made on another device. - Note: Any unfinished transactions will be emitted from `updates` when you first iterate the sequence.

get · iOS 16.0+

currency

TypeScript
get currency(): (_Foundation_Locale_Currency) | null
Swift declaration
@backDeployed(before: iOS 17.2, macOS 14.2, tvOS 17.2, watchOS 10.2, visionOS 1.1)
var currency: Locale.Currency? { get }

The `Locale.Currency` used for the purchase.

get · iOS 15.0+ · Deprecated in iOS 17.2

offerType

TypeScript
get offerType(): (Transaction_OfferType) | null
Swift declaration
var offerType: Transaction.OfferType? { get }

The type of subscription offer applied to this transaction. - Note: Only for subscriptions. @DeprecationSummary { Use the ``offer`` property instead. }

get · iOS 15.0+

productID

TypeScript
get productID(): string
Swift declaration
let productID: String

Identifies the product the transaction is for.

Skipped declarations

No declarations were skipped in this snapshot.

All StoreKit types →