Coupons
Create Coupon
Generate a new promotional coupon for an affiliate
POST
Create a new promotional coupon for an affiliate. The coupon is created at your payment provider and linked to the affiliate in Affonso.
Body Parameters
The ID of the affiliate who will own this coupon.
The coupon code. Must be 1-50 characters, alphanumeric characters and hyphens only. Will be converted to uppercase.
Type of discount to apply. Valid values:
percentage, fixed.The discount amount. For
percentage: value between 0-100. For fixed: the discount amount in the specified currency.How long the discount applies. Valid values:
forever: Discount applies to all future invoicesonce: Discount applies only to the first invoicerepeating: Discount repeats for a specified number of months
Number of months the discount repeats. Required when
duration is repeating.Three-letter currency code (e.g.,
USD, EUR, GBP). Required when discount_type is fixed.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.Always
true for successful responsesThe created coupon object.
Error Responses
404 Not Found
Returned when the specified affiliate does not exist or does not belong to your team.
Error code:
NOT_FOUND400 Bad Request
Returned when the affiliate has no program partnership or the program has no payment provider configured.
Error code:
VALIDATION_ERROR409 Conflict
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_ERROR502 Bad Gateway
Returned when the payment provider fails to create the coupon.
