跳转到内容

Overview

  • Version: 2.0.0
  • Servers: https://store.xsolla.com/api
  • Contact Us by Email
  • Contact URL: https://xsolla.com/
  • Required TLS version: 1.2

LiveOps API提供用于提升玩家参与度的端点。

下载 OpenAPI 描述
语言
服务器
Mock server
https://xsolla.redocly.app/_mock/zh/api/liveops/
https://store.xsolla.com/api/
操作

优惠券

此API让您可以管理优惠券。

操作

请求

兑换优惠券码。用户在兑换优惠券后获得奖励。

安全
XsollaLoginUserJWT
路径
project_idinteger必需

项目ID。您可以在您的发布商帐户项目名称旁边找到。

示例: 44056
正文application/json
coupon_codestring[ 1 .. 128 ] characters

唯一优惠券码。包含字母和数字。

默认值 "WINTER2021"
示例: "WINTER2021"
selected_unit_itemsobject(Promotions_selected_unit_items)

用户选择的奖励。 对象键是单位的SKU,值是单位中一个商品的SKU。

示例: {"game_1":"game_1_steam","game_2":"game_2_playstation"}
curl -i -X POST \
  https://xsolla.redocly.app/_mock/zh/api/liveops/v2/project/44056/coupon/redeem \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "coupon_code": "WINTER2021",
    "selected_unit_items": {
      "game_1": "game_1_steam",
      "game_2": "game_2_playstation"
    }
  }'

响应

优惠券已成功兑换。

正文application/json
itemsArray of objects
示例: [{"attributes":[],"description":"Take it, take it all! All of Xsolla's riches in one Mega Booster.","groups":[{"external_id":"powerups","name":"Power Ups"}],"image_url":"https://cdn.xsolla.net/img/misc/images/e9f2f4a634bc96ea03b5d5ceadd7c55f.png","is_free":false,"name":"Xsolla Booster Mega","price":{"amount":"50.0000000000000000","amount_without_discount":"100.0000000000000000","currency":"USD"},"quantity":1,"sku":"com.xsolla.booster_mega_1","type":"virtual_good","virtual_item_type":"consumable","virtual_prices":[]}]
响应
application/json
{ "items": [ {} ] }

获取优惠券促销活动列表Server-sideAdmin

请求

获取项目的优惠券促销活动列表。

安全
basicAuth
路径
project_idinteger必需

项目ID。您可以在您的发布商帐户项目名称旁边找到。

示例: 44056
查询
limitinteger>= 1

页面上元素数量的限制。

示例: limit=50
offsetinteger>= 0

元素编号,从该元素开始生成列表(从0开始数)。

示例: offset=0
curl -i -X GET \
  -u <username>:<password> \
  'https://xsolla.redocly.app/_mock/zh/api/liveops/v3/project/44056/admin/coupon?limit=50&offset=0'

响应

优惠券列表已成功收到。

正文application/json
active_promotions_countinteger(active_promotions_count)

进行中的促销活动的数量。

inactive_promotions_countinteger(inactive_promotions_count)

已停用的促销活动的数量。

itemsArray of objects(admin-promotions_200-get-coupon-promotion-model)
total_promotions_countinteger(total_promotions_count)

促销活动总数。

响应
application/json
{ "active_promotions_count": 2, "inactive_promotions_count": 0, "items": [ {}, {} ], "total_promotions_count": 2 }

创建优惠券促销活动Server-sideAdmin

请求

创建优惠券促销活动。

安全
basicAuth
路径
project_idinteger必需

项目ID。您可以在您的发布商帐户项目名称旁边找到。

示例: 44056
正文application/json
attribute_conditionsArray of type = string (object) or type = number (object) or type = date (object)(promotion_user-attribute_conditions_model-post)[ 1 .. 100 ] items

用户属性验证条件。 根据用户属性是否满足所有指定条件来确定促销活动可用性。

bonusArray of objects or null(Promotions_coupon_bonus)
external_idstring(Promotions_coupon-external_id)必需

唯一促销活动ID。 external_id只能包含大小写英文字母和数字字符、句点、破折号和下划线。

默认值 "coupon_external_id"
示例: "coupon_external_id"
nameobject(Promotions_coupon_name)必需

促销活动名称。应包含键/值对, 其中键是"^[a-z]{2}-[A-Z]{2}$"格式的区域设置,值是字符串。

默认值 {"de-DE":"Gutscheintitel","en-US":"Coupon title"}
示例: {"de-DE":"Gutscheintitel","en-US":"Coupon title"}
name.​property name*string附加属性
promotion_periodsArray of objects(promotion_periods)

促销活动有效期。若指定了多个时间段,则date_fromdate_until均为必需。

redeem_code_limitinteger or null(Promotions_redeem_code_limit)

每个代码的兑换次数。

默认值 10
示例: 10
redeem_total_limitinteger or null(Promotions_coupon-redeem_total_limit)

限制优惠券的总数。

默认值 10
示例: 10
redeem_user_limitinteger or null(Promotions_coupon-redeem_user_limit)

限制单个用户兑换的优惠券总数。

默认值 10
示例: 10
curl -i -X POST \
  -u <username>:<password> \
  https://xsolla.redocly.app/_mock/zh/api/liveops/v3/project/44056/admin/coupon \
  -H 'Content-Type: application/json' \
  -d '{
    "attribute_conditions": [
      {
        "attribute": "account_status",
        "can_be_missing": false,
        "operator": "eq",
        "type": "string",
        "value": "golden"
      }
    ],
    "bonus": [
      {
        "quantity": 1,
        "sku": "com.xsolla.elven_sword_2"
      }
    ],
    "external_id": "coupon_external_id",
    "name": {
      "de-DE": "Neujahrsbonus",
      "en-US": "New Year Bonus"
    },
    "promotion_periods": [
      {
        "date_from": "2020-04-15T18:16:00+05:00",
        "date_until": "2020-04-25T18:16:00+05:00"
      }
    ],
    "redeem_code_limit": 1,
    "redeem_total_limit": 100,
    "redeem_user_limit": 1
  }'

响应

优惠券已成功创建。

正文application/json
external_idstring(Promotions_coupon-external_id)

唯一促销活动ID。 external_id只能包含大小写英文字母和数字字符、句点、破折号和下划线。

默认值 "coupon_external_id"
示例: "coupon_external_id"
响应
application/json
{ "external_id": "coupon_external_id" }

促销码

此API让您可以管理促销码。

操作

特别目录优惠

此API让您可以管理特别目录优惠活动。

操作

折扣

此API让您可以管理折扣促销活动。

操作

奖励

此API让您可以管理奖励促销活动。

操作

个性化目录

此API可让您针对用户属性指定规则。如果用户满足具体规则的所有条件,则会显示个性化商品。

有关个性化促销活动的信息,请参阅促销活动部分

要在购买前传递属性,您可以使用艾克索拉Login API或在使Pay Station API生成令牌时将它们传入user.attributes属性

操作
操作
操作
操作
操作
操作
操作
操作
操作
操作
操作