Class: WhopSDK::Models::PromoCodeCreateParams

Inherits:
Internal::Type::BaseModel show all
Extended by:
Internal::Type::RequestParameters::Converter
Includes:
Internal::Type::RequestParameters
Defined in:
lib/whop_sdk/models/promo_code_create_params.rb

Overview

Instance Attribute Summary collapse

Attributes included from Internal::Type::RequestParameters

#request_options

Instance Method Summary collapse

Methods included from Internal::Type::RequestParameters::Converter

dump_request

Methods included from Internal::Type::RequestParameters

included

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(amount_off:, base_currency:, code:, company_id:, new_users_only:, promo_duration_months:, promo_type:, churned_users_only: nil, existing_memberships_only: nil, expires_at: nil, one_per_customer: nil, plan_ids: nil, product_id: nil, stock: nil, unlimited_stock: nil, request_options: {}) ⇒ Object

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

unlimited_

Parameters:

  • amount_off (Float)

    The discount amount. When promo_type is percentage, this is the percent off (e.g

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

    The three-letter ISO currency code for the promo code discount.

  • code (String)

    The alphanumeric code customers enter at checkout to apply the discount.

  • company_id (String)

    The unique identifier of the company to create this promo code for.

  • new_users_only (Boolean)

    Whether to restrict this promo code to only users who have never purchased from

  • promo_duration_months (Integer)

    The number of billing months the discount remains active. For example, 3 means t

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

    The discount type, either percentage or flat_amount.

  • churned_users_only (Boolean, nil) (defaults to: nil)

    Whether to restrict this promo code to only users who have previously churned fr

  • existing_memberships_only (Boolean, nil) (defaults to: nil)

    Whether this promo code can only be applied to existing memberships, such as for

  • expires_at (Time, nil) (defaults to: nil)

    The datetime when the promo code expires and can no longer be used. Null means i

  • one_per_customer (Boolean, nil) (defaults to: nil)

    Whether each customer can only use this promo code once.

  • plan_ids (Array<String>, nil) (defaults to: nil)

    The identifiers of plans this promo code applies to. When product_id is also pro

  • product_id (String, nil) (defaults to: nil)

    The identifier of the product to scope this promo code to. When provided, the pr

  • stock (Integer, nil) (defaults to: nil)

    The maximum number of times this promo code can be used. Ignored when

  • unlimited_stock (Boolean, nil) (defaults to: nil)

    Whether the promo code can be used an unlimited number of times.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}) (defaults to: {})


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

Instance Attribute Details

#amount_offFloat

The discount amount. When promo_type is percentage, this is the percent off (e.g., 20 for 20% off). When promo_type is flat_amount, this is the currency amount off (e.g., 10.00 for $10.00 off).

Returns:

  • (Float)


16
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 16

required :amount_off, Float

#base_currencySymbol, WhopSDK::Models::Currency

The three-letter ISO currency code for the promo code discount.

Returns:



22
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 22

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

#churned_users_onlyBoolean?

Whether to restrict this promo code to only users who have previously churned from the company.

Returns:

  • (Boolean, nil)


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

optional :churned_users_only, WhopSDK::Internal::Type::Boolean, nil?: true

#codeString

The alphanumeric code customers enter at checkout to apply the discount.

Returns:

  • (String)


28
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 28

required :code, String

#company_idString

The unique identifier of the company to create this promo code for.

Returns:

  • (String)


34
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 34

required :company_id, String

#existing_memberships_onlyBoolean?

Whether this promo code can only be applied to existing memberships, such as for cancellation retention offers.

Returns:

  • (Boolean, nil)


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

optional :existing_memberships_only, WhopSDK::Internal::Type::Boolean, nil?: true

#expires_atTime?

The datetime when the promo code expires and can no longer be used. Null means it never expires.

Returns:

  • (Time, nil)


75
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 75

optional :expires_at, Time, nil?: true

#new_users_onlyBoolean

Whether to restrict this promo code to only users who have never purchased from the company before.

Returns:

  • (Boolean)


41
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 41

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

#one_per_customerBoolean?

Whether each customer can only use this promo code once.

Returns:

  • (Boolean, nil)


81
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 81

optional :one_per_customer, WhopSDK::Internal::Type::Boolean, nil?: true

#plan_idsArray<String>?

The identifiers of plans this promo code applies to. When product_id is also provided, only plans attached to that product are included.

Returns:

  • (Array<String>, nil)


88
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 88

optional :plan_ids, WhopSDK::Internal::Type::ArrayOf[String], nil?: true

#product_idString?

The identifier of the product to scope this promo code to. When provided, the promo code only applies to plans attached to this product.

Returns:

  • (String, nil)


95
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 95

optional :product_id, String, nil?: true

#promo_duration_monthsInteger

The number of billing months the discount remains active. For example, 3 means the discount applies to the first 3 billing cycles.

Returns:

  • (Integer)


48
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 48

required :promo_duration_months, Integer

#promo_typeSymbol, WhopSDK::Models::PromoType

The discount type, either percentage or flat_amount.

Returns:



54
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 54

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

#stockInteger?

The maximum number of times this promo code can be used. Ignored when unlimited_stock is true.

Returns:

  • (Integer, nil)


102
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 102

optional :stock, Integer, nil?: true

#unlimited_stockBoolean?

Whether the promo code can be used an unlimited number of times.

Returns:

  • (Boolean, nil)


108
# File 'lib/whop_sdk/models/promo_code_create_params.rb', line 108

optional :unlimited_stock, WhopSDK::Internal::Type::Boolean, nil?: true