Class: WhopSDK::Models::PromoCodeListResponse

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/whop_sdk/models/promo_code_list_response.rb

Overview

Defined Under Namespace

Classes: Product

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, amount_off:, churned_users_only:, code:, created_at:, currency:, duration:, existing_memberships_only:, expires_at:, new_users_only:, one_per_customer:, product:, promo_duration_months:, promo_type:, status:, stock:, unlimited_stock:, uses:) ⇒ Object

Some parameter documentations has been truncated, see WhopSDK::Models::PromoCodeListResponse for more details.

A promo code applies a discount to a plan during checkout. Promo codes can be percentage-based or fixed-amount, and can have usage limits and expiration dates.

Parameters:

  • id (String)

    The unique identifier for the promo code.

  • amount_off (Float)

    The discount amount. Interpretation depends on promo_type: if ‘percentage’, this

  • churned_users_only (Boolean)

    Restricts promo use to only users who have churned from the company before.

  • code (String, nil)

    The specific code used to apply the promo at checkout.

  • created_at (Time)

    The datetime the promo code was created.

  • currency (Symbol, WhopSDK::Models::Currency)

    The monetary currency of the promo code.

  • duration (Symbol, WhopSDK::Models::PromoDuration, nil)

    The duration setting for the promo code

  • existing_memberships_only (Boolean)

    Restricts promo use to only be applied to already purchased memberships.

  • expires_at (Time, nil)

    The date/time of when the promo expires.

  • new_users_only (Boolean)

    Restricts promo use to only users who have never purchased from the company befo

  • one_per_customer (Boolean)

    Restricts promo use to only be applied once per customer.

  • product (WhopSDK::Models::PromoCodeListResponse::Product, nil)

    The product this promo code applies to

  • promo_duration_months (Integer, nil)

    The number of months the promo is applied for.

  • promo_type (Symbol, WhopSDK::Models::PromoType)

    The type (% or flat amount) of the promo.

  • status (Symbol, WhopSDK::Models::PromoCodeStatus)

    Indicates if the promo code is live or disabled.

  • stock (Integer)

    The quantity limit on the number of uses.

  • unlimited_stock (Boolean)

    Whether or not the promo code has unlimited stock.

  • uses (Integer)

    The amount of times the promo codes has been used.



# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 118

Instance Attribute Details

#amount_offFloat

The discount amount. Interpretation depends on promo_type: if ‘percentage’, this is the percentage (e.g., 20 means 20% off); if ‘flat_amount’, this is dollars off (e.g., 10.00 means $10.00 off).

Returns:

  • (Float)


19
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 19

required :amount_off, Float

#churned_users_onlyBoolean

Restricts promo use to only users who have churned from the company before.

Returns:

  • (Boolean)


25
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 25

required :churned_users_only, WhopSDK::Internal::Type::Boolean

#codeString?

The specific code used to apply the promo at checkout.

Returns:

  • (String, nil)


31
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 31

required :code, String, nil?: true

#created_atTime

The datetime the promo code was created.

Returns:

  • (Time)


37
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 37

required :created_at, Time

#currencySymbol, WhopSDK::Models::Currency

The monetary currency of the promo code.

Returns:



43
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 43

required :currency, enum: -> { WhopSDK::Currency }

#durationSymbol, ...

The duration setting for the promo code

Returns:



49
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 49

required :duration, enum: -> { WhopSDK::PromoDuration }, nil?: true

#existing_memberships_onlyBoolean

Restricts promo use to only be applied to already purchased memberships.

Returns:

  • (Boolean)


55
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 55

required :existing_memberships_only, WhopSDK::Internal::Type::Boolean

#expires_atTime?

The date/time of when the promo expires.

Returns:

  • (Time, nil)


61
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 61

required :expires_at, Time, nil?: true

#idString

The unique identifier for the promo code.

Returns:

  • (String)


11
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 11

required :id, String

#new_users_onlyBoolean

Restricts promo use to only users who have never purchased from the company before.

Returns:

  • (Boolean)


68
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 68

required :new_users_only, WhopSDK::Internal::Type::Boolean

#one_per_customerBoolean

Restricts promo use to only be applied once per customer.

Returns:

  • (Boolean)


74
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 74

required :one_per_customer, WhopSDK::Internal::Type::Boolean

#productWhopSDK::Models::PromoCodeListResponse::Product?

The product this promo code applies to



80
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 80

required :product, -> { WhopSDK::Models::PromoCodeListResponse::Product }, nil?: true

#promo_duration_monthsInteger?

The number of months the promo is applied for.

Returns:

  • (Integer, nil)


86
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 86

required :promo_duration_months, Integer, nil?: true

#promo_typeSymbol, WhopSDK::Models::PromoType

The type (% or flat amount) of the promo.

Returns:



92
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 92

required :promo_type, enum: -> { WhopSDK::PromoType }

#statusSymbol, WhopSDK::Models::PromoCodeStatus

Indicates if the promo code is live or disabled.



98
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 98

required :status, enum: -> { WhopSDK::PromoCodeStatus }

#stockInteger

The quantity limit on the number of uses.

Returns:

  • (Integer)


104
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 104

required :stock, Integer

#unlimited_stockBoolean

Whether or not the promo code has unlimited stock.

Returns:

  • (Boolean)


110
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 110

required :unlimited_stock, WhopSDK::Internal::Type::Boolean

#usesInteger

The amount of times the promo codes has been used.

Returns:

  • (Integer)


116
# File 'lib/whop_sdk/models/promo_code_list_response.rb', line 116

required :uses, Integer