Skip to content

Gift Card

Authentication

参考接入 BytePower

获取当前用户礼品卡

Method & Path

  • GET {domain}/bp/gift_card
  • GET {domain}/bp/server/user/{user_id}/gift_card

接口功能: 获取用户当前的礼品卡

Request

Response

  • HTTP 状态码:200
json
{
  "gift_cards": [
    {
      "gift_id": "GIFEBIJ2WJSWFM2Y",
      "description": "20% off",
      "detail": "八折优惠",
      "quota": 0,
      "claimed_count": 1,
      "expired_time": "2023-12-12T12:34:56Z"
    },
    {
      "gift_id": "GIFEBIJ2WSNHAZ2L",
      "description": "20% off",
      "detail": "八折优惠",
      "quota": 0,
      "claimed_count": 1,
      "expired_time": "2023-12-12T12:34:56Z"
    }
  ]
}
  • HTTP 状态码:4xx
json
{
  "error": {
    "error_type": "invalid_parameter",
    "message": "xxxxx"
  }
}

error_type:

  • item_not_found(找不到条目)
  • config_invalid (console 配置问题)

领取礼品卡

Method & Path

  • POST {domain}/bp/gift_card/claim
  • POST {domain}/bp/server/user/{user_id}/gift_card/claim

接口功能: 用户领取礼品卡,礼品卡可绑定可消耗资产

Request

  • content-type: "application/json"
ParametersTypeRequiredDesc
gift_idstringtrue礼品卡 ID
json
{
  "gift_id": "gift_id"
}

Response

  • HTTP 状态码:200
json
{
  "gift_card": {
    "gift_id": "GIFEJ3GDFTA2L3BS",
    "description": "vip credit",
    "detail": "",
    "asset_name": "ai_credit",
    "quota": 5,
    "quantity": 3,
    "claimed_count": 3,
    "expired_time": "2024-03-21T00:00:00Z"
  }
}
  • HTTP 状态码:4xx
json
{
  "error": {
    "error_type": "invalid_parameter",
    "message": "xxxxx"
  }
}

error_type:

  • invalid_parameter(无效参数)
  • config_invalid (console 配置问题)

京ICP备19011570号-2