Skip to content

Discount_Attributes

mauryaratan edited this page Feb 5, 2023 · 1 revision

Discount.Attributes

An object representing the resources data.

public struct Attributes: Codable 

Inheritance

Codable

Properties

storeId

The ID of the store this discount belongs to.

public let storeId: Int

name

The name of the discount.

public let name: String

code

The discount code that can be used at checkout.

public let code: String

amount

The amount of discount to apply to the order. Either a fixed amount or a percentage depending on the value of amountType.

public let amount: Int

amountType

The type of the amount. Either percent or fixed.

public let amountType: String

isLimitedToProducts

Has the value true if the discount can only be applied to certain products/variants.

public let isLimitedToProducts: Bool

isLimitedRedemptions

Has the value true if the discount can only be redeemed a limited number of times.

public let isLimitedRedemptions: Bool

maxRedemptions

If isLimitedRedemptions is true, this is the maximum number of redemptions.

public let maxRedemptions: Int

startsAt

An ISO-8601 formatted date-time string indicating when the discount is valid from. Can be null if no start date is specified.

public let startsAt: String?

expiresAt

An ISO-8601 formatted date-time string indicating when the discount expires. Can be null if no expiration date is specified.

public let expiresAt: String?

duration

If the discount is applied to a subscription, this specifies how often the discount should be applied. One of once, repeating, forever.

public let duration: String

durationInMonths

If duration is repeating, this specifies how many months the discount should apply

public let durationInMonths: Int

status

The status of the discount. Either draft or published.

public let status: String

statusFormatted

The formatted status of the discount.

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

testMode

A boolean indicating if the returned subscription object was created within test mode.

public let testMode: Bool
Types
Global Functions
Clone this wiki locally