# NamiPurchase

{% tabs %}
{% tab title="Swift" %}

```swift
public class NamiPurchase : NSObject, Codable {
    public var sku : NamiSKU,
    public var expires : Date?
    public var entitlementsGranted: [NamiEntitlement]
    public var transactionIdentifier : String?
    public var transaction : SKPaymentTransaction?
    public let skuId : StoreID
    public var purchaseInitiatedTimestamp: Date
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
data class NamiPurchase( 
    val purchaseInitiatedTimestamp: Long = Date().time,
    val expires: Date? = null,
    val purchaseSource: NamiPurchaseSource,
    val skuId: String,
    val transactionIdentifier: String?,
    val purchaseToken: String?
 )
```

{% endtab %}

{% tab title="Flutter" %}

```dart
class NamiPurchase {
  final int purchaseInitiatedTimestamp;
  final DateTime? expires;
  final NamiPurchaseSource purchaseSource;
  final String skuId;
  final String? transactionIdentifier;
  final String? localizedDescription;
}
```

{% endtab %}

{% tab title="React Native" %}

```javascript
export type NamiPurchase = {
  sku?: NamiSKU;
  skuId: string;
  transactionIdentifier?: string;
  expires?: Date;
  purchaseInitiatedTimestamp: Date;
  purchaseSource?: "CAMPAIGN" | "MARKETPLACE" | "UNKNOWN";
};
```

{% endtab %}

{% tab title="Unity" %}

```c
public class NamiPurchase
{
    public long PurchaseInitiatedTimestamp { get; private set; }

    public DateTime Expires { get; private set; }

    /// <summary> Android platforms only </summary>
    public NamiPurchaseSource PurchaseSource { get; private set; }

    public string SkuId { get; private set; }

    public string TransactionIdentifier { get; private set; }

    /// <summary> Android platforms only </summary>
    public string PurchaseToken { get; private set; }

    /// <summary> Apple platforms only </summary>
    public NamiSKU Sku { get; private set; }

    /// <summary> Apple platforms only </summary>
    public List<NamiEntitlement> EntitlementsGranted { get; private set; }

    /// <summary> Apple platforms only </summary>
    public string Transaction { get; private set; }
}
```

{% endtab %}
{% endtabs %}

**Parameters**

Each App Platform provides data in NamiPurchase based upon what is available in the underlying store APIs.

**App Store**

* `sku` - a [NamiSKU](/sdk-reference/namipurchasemanager/namisku.md) object representing the in-app purchase product SKU the device purchased.
* `expires` - date the purchase expires if it is a subscription
* `entitlementGranted` - a [NamiEntitlement](/sdk-reference/namientitlementmanager/namientitlement.md) object for the entitlement granted by this purchase.
* `transactionIdentifier` - App Store ID for the transaction
* `transaction` - the StoreKit transaction object for the purchase
* `skuId` - the App Store reference ID of the purchased product SKU
* `purchaseInitiatedTimestamp` - The date and time when the purchase was initiated

**Google Play**

* `purchaseInitiatedTimestamp` - The date and time when the purchase was initiated
* `expires` - (bypass store only) Indicates when this purchase will cease
* `skuId` - the Google Play reference ID of the purchased product SKU
* `transactionIdentifier` - The purchase order ID record associated to this purchase
* `purchaseToken` - The purchase token associated to this purchase


---

# Agent Instructions: 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:

```
GET https://docs.namiml.com/sdk-reference/namipurchasemanager/namipurchase.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
