Skip to content

作废优惠券 ​

POST /coupons/{couponId}/void

权限范围幂等operationId
assets:write本身幂等AssetGrants_voidCoupon

作废未使用的券。已作废的再调一次直接返回;已使用、已过期、下单占用中的券不能作废(422)。

幂等:本身幂等,重复调用结果相同。

参数 ​

名称位置类型必填说明
couponId路径string是优惠券 ID(cp_…)

请求体 ​

VoidCoupon ​

字段类型必填说明
reasonstring原因(写进操作记录,店铺后台可见)(≤100 字)

示例 ​

js
const res = await client.post("/coupons/cp_1Zrc0HrdPmqo3LLrh92NLMh/void", {
  "reason": "吉祥物每日互动 CDK 兑换"
});
http
POST /open/v1/coupons/cp_1Zrc0HrdPmqo3LLrh92NLMh/void HTTP/1.1
Host: api.sybb.pw
Authorization: SY-HMAC-SHA256 Credential=ak_…, Timestamp=1796035200, Nonce=…, Signature=…
Content-Type: application/json

{
  "reason": "吉祥物每日互动 CDK 兑换"
}

响应 200:

json
{
  "couponId": "cp_1Zrc0HrdPmqo3LLrh92NLMh",
  "templateId": "ctpl_12bSxK7PtEm1DoKtT0783s3",
  "memberId": "mb_1sKVu55B92JYxO8sHKyX1Cd",
  "name": "周末双排体验券",
  "type": "full_reduction",
  "discountValueCents": 10000,
  "discountRate": 1,
  "minAmountCents": 10000,
  "maxDiscountCents": 10000,
  "status": "available",
  "validFrom": "2026-11-30T20:15:00+08:00",
  "expiresAt": "2026-11-30T20:15:00+08:00",
  "issuedAt": "2026-11-30T20:15:00+08:00",
  "usedAt": "2026-11-30T20:15:00+08:00",
  "usedOrderId": "ord_1fw6UrApE6WukjOyr9PYvD6"
}

响应 ​

CouponView ​

字段类型必填说明
couponIdstring优惠券 ID(cp_…)
templateIdstring券模板 ID(ctpl_…)
memberIdstring会员 ID(mb_…)
namestring名称
typestringfull_reduction 满减 / discount 折扣 / direct_reduction 直减 / free 免单
discountValueCentsinteger满减 / 直减券的面额(分);折扣券为 null
discountRatenumber折扣券的折扣(如 8.5 = 八五折);其他券为 null
minAmountCentsinteger金额(分)
maxDiscountCentsinteger金额(分)
statusstringavailable 可用 / frozen 下单占用中 / used 已用 / expired 已过期 / voided 已作废
validFromstringRFC 3339,如 2026-11-30T20:15:00+08:00
expiresAtstring时间(RFC 3339)
issuedAtstring时间(RFC 3339)
usedAtstring时间(RFC 3339)
usedOrderIdstring订单 ID(ord_…)

错误 ​

HTTP错误码含义
404NOT_FOUND资源不存在或不属于本店
422BUSINESS_RULE业务规则不满足

签名、权限、限流等通用错误见错误处理。

ByteForge · 神运开放平台接口地址 https://api.sybb.pw/open/v1