Skip to content

Variant_Attributes

mauryaratan edited this page Feb 5, 2023 · 1 revision

Variant.Attributes

An object representing the resources data.

public struct Attributes: Codable 

Inheritance

Codable

Properties

productId

The ID of the product this variant belongs to.

public let productId: Int

name

The name of the variant.

public let name: String

slug

The slug used to identify the variant.

public let slug: String

description

The description of the variant in HTML.

public let description: String?

price

A positive integer in cents representing the price of the variant.

public let price: Int

isSubscription

Has the value true if this variant is a subscription

public let isSubscription: Bool

interval

If this variant is a subscription, this is the frequency at which a subscription is billed. One of day, week, month or year.

public let interval: String?

intervalCount

If this variant is a subscription, this is the number of intervals (specified in the interval attribute) between subscription billings. For example, interval=month and interval_count=3 bills every 3 months.

public let intervalCount: Int?

hasFreeTrial

Has the value true if this variant has a free trial period. Only available if the variant is a subscription.

public let hasFreeTrial: Bool

trialInterval

The interval unit of the free trial. One of day, week, month or year.

public let trialInterval: String

trialIntervalCount

If interval count of the free trial. For example, a variant with trial_interval=day and trial_interval_count=14 would have a free trial that lasts 14 days.

public let trialIntervalCount: Int?

payWhatYouWant

Has the value true if this is a “pay what you want” variant where the price can be set by the customer at checkout.

public let payWhatYouWant: Bool

minPrice

If payWhatYouWant is true, this is the minimum price this variant can be purchased for, as a positive integer in cents

public let minPrice: Int

suggestedPrice

If payWhatYouWant is true, this is the suggested price for this variant shown at checkout, as a positive integer in cents

public let suggestedPrice: Int

hasLicenseKeys

Has the value true if this variant should generate license keys for the customer on purchase.

public let hasLicenseKeys: Bool

licenseActivationLimit

The maximum number of times a license key can be activated for this variant.

public let licenseActivationLimit: Int

isLicenseLimitUnlimited

Has the value true if license key activations are unlimited for this variant.

public let isLicenseLimitUnlimited: Bool

licenseLengthValue

The number of units (specified in the license_length_unit attribute) until a license key expires.

public let licenseLengthValue: Int

licenseLengthUnit

The unit linked with the license_length_value attribute. One of days, months or years. For example, license_length_value=3 and license_length_unit=months license keys will expire after 3 months.

public let licenseLengthUnit: String

isLicenseLengthUnlimited

Has the value true if license keys should never expire.

public let isLicenseLengthUnlimited: Bool

Note: If the variant is a subscription, the license key expiration will be linked to the status of the subscription (e.g. the license will expire when the subscription expires).

sort

An integer representing the order of this variant when displayed on the checkout.

public let sort: Int

status

The status of the variant. Either pending, draft or published. If a variant has a pending status, it is considered the “default” variant and is not shown as a separate option at checkout.

public let status: String

statusFormatted

The formatted status of the variant.

public let statusFormatted: String

createdAt

An ISO-8601 formatted date-time string indicating when the object was created.

public let createdAt: String

updatedAt

An ISO-8601 formatted date-time string indicating when the object was last updated.

public let updatedAt: String
Types
Global Functions
Clone this wiki locally