> For the complete documentation index, see [llms.txt](https://docs.onside.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.onside.io/sdk/reference/models.md).

# Models

OnsideKit's public models are value types (`Sendable`, safe to pass across actors).

## OnsidePaymentTransaction

A snapshot of a transaction in the [payment queue](/sdk/core-concepts/payment-queue.md).

<table><thead><tr><th width="320">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>id: UUID</code></td><td>Stable local identifier for this transaction.</td></tr><tr><td><code>transactionIdentifier: String?</code></td><td>Server-side transaction id (may be absent while <code>.purchasing</code>).</td></tr><tr><td><code>originalTransactionIdentifier: String?</code></td><td>Id of the original transaction (for restored/renewed cases).</td></tr><tr><td><code>payment: OnsidePayment</code></td><td>The payment that produced this transaction.</td></tr><tr><td><code>transactionState: OnsidePaymentTransactionState</code></td><td>Current state.</td></tr><tr><td><code>storefront: OnsideStorefront</code></td><td>The storefront the transaction belongs to.</td></tr><tr><td><code>error: OnsidePaymentTransactionError?</code></td><td>Set only for <code>.failed</code> transactions.</td></tr></tbody></table>

`func isSame(as another: OnsidePaymentTransaction) -> Bool` — compares by `id`. Use it to correlate updates for the same transaction across state changes.

## OnsidePaymentTransactionState

```swift
enum OnsidePaymentTransactionState {
    case purchasing   // in flight
    case purchased    // bought successfully
    case restored     // surfaced by restoreCompletedTransactions
    case failed       // failed; see transaction.error
}
```

## OnsidePayment

```swift
struct OnsidePayment {
    var product: OnsideProduct
    var appAccountToken: String?

    init(product: OnsideProduct)
}
```

`appAccountToken` correlates the purchase with your account system. The only initializer is `init(product:)`; set the token by mutating the value.

## OnsideProduct

<table><thead><tr><th width="320">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>productIdentifier: String</code></td><td>The Onside identifier (slug) you requested.</td></tr><tr><td><code>localizedTitle: String</code></td><td>Display title.</td></tr><tr><td><code>localizedDescription: String</code></td><td>Display description.</td></tr><tr><td><code>iconUrl: URL?</code></td><td>Icon URL, if available.</td></tr><tr><td><code>price: OnsidePrice</code></td><td>Price.</td></tr><tr><td><code>subscriptionPeriod: OnsidePeriod?</code></td><td>Recurring period (subscriptions only).</td></tr><tr><td><code>subscriptionGroupIdentifier: String?</code></td><td>Subscription group (subscriptions only).</td></tr></tbody></table>

See [Subscriptions](/sdk/products-and-subscriptions/subscriptions.md) for the subscription fields.

## Pricing types

```swift
struct OnsidePrice {
    var value: Double
    var currencyCode: String   // ISO 4217, e.g. "EUR"
}

enum OnsidePeriod {
    case day(UInt)
    case week(UInt)
    case month(UInt)
    case year(UInt)
}
```

## OnsideStorefront

```swift
struct OnsideStorefront {
    var id: String
    var countryCode: String   // the user's region, e.g. "US"
}
```

## OnsideProductsResponse

```swift
struct OnsideProductsResponse {
    var products: [OnsideProduct]
    var invalidProductIdentifiers: [String]   // requested identifiers not found
}
```

## OnsideSignedInAppsHistory

```swift
struct OnsideSignedInAppsHistory {
    var data: Data        // raw JWS blob
    var string: String?   // UTF-8 decoding of `data`, when valid
}
```

## OnsideAttributionMetadata

```swift
struct OnsideAttributionMetadata {
    var refererUrl: URL?
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.onside.io/sdk/reference/models.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
