Coupons
The coupon object
A coupon is a discount, a percentage or a fixed amount off, that you apply to invoices, quotes, subscriptions and Checkout Sessions, either directly or through a promotion code a customer enters.
Attributes
idstringRequiredUnique identifier for the object.
objectstringRequiredString naming the object's type.
livemodebooleanRequiredtruewhen the object exists in live mode,falsein test mode.createdtimestampRequiredTime the object was created, in Unix seconds.
updatedtimestampRequiredTime the object last changed, in Unix seconds.
namestringRequiredName of the coupon. Its letters and digits also start the code of the promotion code created with the coupon.
activebooleanRequiredWhether the coupon can be redeemed. An inactive coupon is refused on new invoices, quotes and checkouts.
durationenumRequiredHow long the discount lasts on a subscription:
once,repeatingorforever.onceThe discount applies to the first billing period only.
repeatingThe discount applies for
duration_in_monthsmonths from when it is first applied.foreverThe discount applies to every billing period.
duration_in_monthsintegerRequiredNumber of months the discount lasts when
durationisrepeating;0otherwise.percentagenumberRequiredPercentage taken off, above 0 and up to 100.
0for a fixed-amount coupon.fixed_amountintegerRequiredAmount taken off, in the smallest unit of
currency(for example,5000is 50.00 THB).0for a percentage coupon.currencystringRequiredThree-letter ISO 4217 code of
fixed_amount, in lowercase. Empty when no currency was set, which is usual for a percentage coupon.redeem_bytimestampRequiredNullableLast time the coupon can be redeemed, in Unix seconds. Null when there is no deadline.
metadataobjectRequiredKey-value pairs you attach to the object for your own use. Paycose never reads or changes them.
max_redemptionsintegerRequiredNullableMaximum number of times the coupon can be redeemed across all customers. Null when there is no limit.
times_redeemedintegerRequiredNumber of times the coupon has been redeemed.
once_per_customerbooleanRequiredWhether each customer can redeem the coupon only once. When
true, the document it is applied to must have a customer.starts_attimestampRequiredNullableEarliest time the coupon can be redeemed, in Unix seconds. Null when it can be redeemed right away.
applies_to_productsarray of stringsRequiredIDs of the products the discount is limited to. Only lines for these products are discounted, and a document with none of them is refused. Empty when the coupon applies to every product.