Coupons

Overview

Coupons provide discounts to customers during checkout. They can offer percentage-based or fixed-amount discounts and can be restricted to specific plans. Coupons track redemption counts and can have expiration dates.

API Endpoints

MethodEndpointDescription
GET/couponsList coupons
POST/couponsCreate coupon
GET/coupons/{id}Get coupon
PUT/coupons/{id}Update coupon
DELETE/coupons/{id}Delete coupon

Important Behaviors

  • Soft delete: Coupons are soft-deleted. Existing subscriptions using the coupon are not affected.
  • Metadata merge: On update, metadata is merged with existing values, not replaced.
  • Plan detach: If plans is not provided on update, existing plan associations may be detached.
  • Redeem by: The redeem_by field is parsed as a date. After this date, the coupon can no longer be applied.
  • Valid default: New coupons default to valid: true.

Coupon Duration

DurationDescription
foreverDiscount applies to all future invoices
onceDiscount applies only to the first invoice

Coupon Object

AttributeTypeDescription
idintegerUnique identifier for the coupon
namestringDisplay name shown on invoices and receipts
coupon_codestringThe code customers enter at checkout
amount_offintegerFixed discount amount in cents
percent_offnumberPercentage discount (e.g. 25 for 25% off)
currencystringCurrency for fixed-amount discounts (ISO 4217)
durationstringHow long the discount applies: forever or once
duration_in_monthsintegerNumber of months for recurring discounts
max_redemptionsintegerMaximum number of times the coupon can be used
times_redeemedintegerNumber of times the coupon has been used
expires_onintegerUnix timestamp after which the coupon cannot be used
validbooleanWhether the coupon is currently valid
plansarrayArray of plans the coupon is restricted to
metadataobjectKey-value pairs for storing additional data
created_atintegerUnix timestamp of creation
updated_atintegerUnix timestamp of last update