Defines the set of constraints that govern how and when the coupon can be redeemed.

Columns

No match found

coupon_id string, not null
Foreign Key coupons.id
The unique identifier of the coupon associated with the constraint.

entity_type string, not null
The resource type to which the constraint applies. Used in combination with type and value to define the rule. Possible value:
  • customer: The constraint is applied based on customer records.

type string, not null
Specifies the type of constraint applied to the coupon. The value of this field, combined with entity_type and value, determines how the constraint is enforced. Possible values are:
  • max_redemptions: Limits the number of times the coupon can be redeemed for a given entity_type. The maximum count is defined in value. For example, if entity_type is customer and value is 10, the coupon can be redeemed up to 10 times for each customer.
  • new_customer: Applies the coupon only to new customers. A customer is considered new if they do not have any prior non-void, non-zero-dollar invoices.
  • existing_customer: Applies the coupon only to existing customers, defined as those who have at least one non-void, non-zero-dollar invoice.
  • unique_by: When entity_type is customer, allows the coupon to be redeemed only once per unique value of a specified customer field, defined in value. For example, if value is email, the coupon can be redeemed only once for each unique customer.email. If multiple customer records share the same email, the coupon is restricted to a single use across those records.

value string, null

Defines the value associated with the coupon constraint. The interpretation of this field depends on the value of constraints[type]:

  • When type is unique_by, the value specifies a unique customer field such as email or id.

  • When type is max_redemptions, the value is an integer representing the maximum number of times the coupon can be redeemed per entity. This number typically ranges from 1 to the defined coupon_max_redemptions.

  • When type is new_customer or existing_customer, the value may reference criteria based on invoice history (e.g., whether a customer has at least one non-void, non-zero-dollar invoice).