Skip to main content
POST
Create a new promotional coupon for an affiliate. The coupon is created at your payment provider and linked to the affiliate in Affonso.
Coupon creation rules vary by payment provider:
  • DODO: Only supports percentage discounts
  • CREEM: Requires at least one product_id
  • All providers: duration_in_months required when duration is repeating
  • All providers: currency required when discount_type is fixed

Body Parameters

string
required
The ID of the affiliate who will own this coupon.
string
required
The coupon code. Must be 1-50 characters, alphanumeric characters and hyphens only. Will be converted to uppercase.
string
required
Type of discount to apply. Valid values: percentage, fixed.
number
required
The discount amount. For percentage: value between 0-100. For fixed: the discount amount in the specified currency.
string
required
How long the discount applies. Valid values:
  • forever: Discount applies to all future invoices
  • once: Discount applies only to the first invoice
  • repeating: Discount repeats for a specified number of months
integer
Number of months the discount repeats. Required when duration is repeating.
string
Three-letter currency code (e.g., USD, EUR, GBP). Required when discount_type is fixed.
array
Array of product IDs to restrict this coupon to. Leave empty or omit to apply to all products.

Response

The response includes the created coupon object.
boolean
Always true for successful responses
object
The created coupon object.

Error Responses

Returned when the specified affiliate does not exist or does not belong to your team. Error code: NOT_FOUND
Returned when the affiliate has no program partnership or the program has no payment provider configured. Error code: VALIDATION_ERROR
Returned when a coupon with the same code already exists in the program, or when the affiliate already has a coupon for this program. Error code: DUPLICATE_ERROR
Returned when the payment provider fails to create the coupon.