Create a discount code
Creates the affiliate's personal discount code on your connected store (Shopify, BigCommerce, WooCommerce, Lemon Squeezy, Paddle, or Stripe).
Body
| Field | Type | Required | Notes |
|---|---|---|---|
| code | string | yes | Alphanumeric (A–Z, 0–9). Unique within your program (and on the connected store). |
Responses
200 — { "success": true }
Errors — all { "error": "<message>" }:
| Status | error values |
|---|---|
| 400 | A discount code is required. · Code must be 4-12 characters and can only contain letters, numbers, dashes and underscores · Discount codes are not configured for this program · Discount code already set · This discount code is already taken. · This store is not connected to Rezfiliate · Discount codes are not supported for this store platform yet. |
| 400 | Platform-specific configuration errors — Paddle: Reconnect Paddle to refresh its API credentials. · Paddle discount codes can contain letters and numbers only. Use an alphanumeric code. · The configured percentage discount cannot exceed 100%. — Lemon Squeezy: Reconnect Lemon Squeezy to refresh its API credentials. · Lemon Squeezy discount codes can contain letters and numbers only. Use an alphanumeric code. · Lemon Squeezy percentage discounts must be a whole number of percent. Adjust the program discount (e.g. 10%). — Shopify: This store's Rezfiliate connection needs to be reauthorized — reconnect the Shopify store and try again. |
| 402 | The store owner needs to upgrade to Scale to use discount code tracking |
| 403 | The affiliate must accept the current affiliate legal terms. · Please verify the affiliate's email address to create a discount code for the affiliate · This program is not online. variants (program paused/terminated) |
| 404 | Affiliate not found |
| 409 | This discount code is already taken. (another affiliate of your program claimed it) · That discount code already exists in Lemon Squeezy. Choose a different code. · This discount code already exists in the store. (a merchant-created WooCommerce coupon) |
| 502 | Store/API failures — e.g. Could not reach the Shopify store to create the discount code. · Could not reach the store (<host>) to create the discount code. · platform-specific rejection messages passed through from Shopify/BigCommerce/Stripe/Paddle/Lemon Squeezy |
One code per affiliate — a second POST returns 400 Discount code already set. Use the DELETE route to remove a code first.
