跳转到主要内容
POST
/
coupon
curl --request POST \
  --url https://uat-api.clinkbill.com/api/coupon \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --header 'X-Timestamp: <api-key>' \
  --data '
{
  "couponName": "Summer Sale",
  "discountType": "percentage",
  "percentage": 20,
  "applyType": "product",
  "applicableProducts": [
    "prd_xxxxx"
  ],
  "durationType": "once",
  "maxRedemptionCount": 100,
  "validPeriodStart": 1780660800000,
  "validPeriodEnd": 1783252800000,
  "promotionCodes": [
    {
      "code": "SUMMER2026",
      "maxRedemptionLimit": 100
    }
  ]
}
'
{
  "code": 200,
  "msg": "success",
  "data": {
    "couponId": "<string>",
    "couponName": "<string>",
    "percentage": 123,
    "fixedAmounts": {},
    "durationMonths": 123,
    "maxRedemptionCount": 123,
    "redeemedCount": 123,
    "validPeriodEnd": 1754819711382,
    "mirroring": true,
    "terms": "<string>"
  }
}

授权

X-API-KEY
string
header
必填

Your secret API key obtained from the Clink dashboard (Developers section)

X-Timestamp
string
header
必填

Current timestamp in milliseconds since Unix epoch (required for request signing)

请求体

application/json

Parameters required to create a coupon

couponName
string
必填

Coupon name

Maximum string length: 40
discountType
enum<string>
必填

Discount type

可用选项:
percentage,
fixed_amount
applyType
enum<string>
必填

Coupon applicability type

可用选项:
none,
product,
price
durationType
enum<string>
必填

Discount duration type

可用选项:
once,
repeating,
forever
percentage
number

Percentage discount. Used when discountType is percentage.

必填范围: 0 <= x <= 100
fixedAmounts
object

Fixed discount amount by currency. Used when discountType is fixed_amount.

示例:
{ "USD": 5, "EUR": 4.5 }
applicableProducts
string[]

Product IDs this coupon applies to

applicablePrices
object

Price IDs this coupon applies to, grouped by product ID

durationMonths
integer<int32>

Number of billing periods for repeating coupons

maxRedemptionCount
integer<int32>

Maximum total redemptions for this coupon

validPeriodStart
integer<int64>

Coupon validity start time as a 13-digit Unix timestamp in milliseconds

示例:

1780660800000

validPeriodEnd
integer<int64>

Coupon validity end time as a 13-digit Unix timestamp in milliseconds

示例:

1780660800000

promotionCodes
object[]

Promotion codes to create together with the coupon

Maximum array length: 20

响应

Coupon created successfully

Body of the response message

code
integer<int32>

Response status code, 200 when success

示例:

200

msg
string

Brief description of what happened, 'success' when happy case

示例:

"success"

data
object