Xsolla-logoXsolla Developers
前往发布商帐户

创建优惠券码Server-sideAdmin

post/v2/project/{project_id}/admin/coupon/{external_id}/code

创建优惠券码。

SecuritybasicAuth
Request
path Parameters
project_id
required
integer

项目编号。您可以在您的发布商帐户项目名称旁边。

Example: 44056
external_id
required
integer

Promotion external ID. Unique promotion identifier within the project.

Example: coupon_44056_1
Request Body schema: application/json
coupon_code
string [ 1 .. 128 ] characters ^[a-zA-Z0-9]+$
Default: "WINTER2021"

区分大小写的唯一券码。包含字母和数字。

Responses
201

代码创建成功。

401

基本认证未通过或错误。确保您使用了基本认证或正确的凭据。

404

未找到优惠券。请确保external_id正确无误。

422

无效的请求。代码已经存在。

Request samples
application/json
{
  • "coupon_code": "WINTER2021"
}
Response samples
application/json
{
  • "errorCode": 4001,
  • "errorMessage": "[0401-9802]: Coupon not found",
  • "statusCode": 404,
  • "transactionId": "x-x-x-x-transactionId-mock-x-x-x"
}