跳转到内容

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让您可以管理优惠券。

操作

促销码

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

操作

移除购物车的促销码Client-side

请求

移除购物车的促销码。 删除促销码后,将重新计算购物车中所有商品的总价,去掉促销码提供的奖励和折扣。

安全
AuthForCart
路径
project_idinteger必需

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

示例: 44056
正文application/json
cartobject or null
curl -i -X PUT \
  https://xsolla.redocly.app/_mock/zh/api/liveops/v2/project/44056/promocode/remove \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "cart": {
      "id": "current"
    }
  }'

响应

促销码已成功取消。

正文application/json
cart_idstring

购物车ID。

示例: "cart_id"
is_freeboolean(value-is_free)

如果为true,则该商品为免费。

默认值 false
示例: false
itemsArray of objects
示例: [{"attributes":[],"can_be_bought":true,"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,"limits":{"per_user":{"available":3,"recurrent_schedule":{"interval_type":"weekly","reset_next_date":1746057600},"total":5}},"name":"Xsolla Booster Mega","periods":[{"date_from":"2020-08-11T10:00:00+03:00","date_until":"2020-08-11T20:00:00+03:00"}],"price":{"amount":"50.0000000000000000","amount_without_discount":"100.0000000000000000","currency":"USD"},"promotions":[{"bonus":[{"image_url":"https://cdn.xsolla.net/img/misc/images/2fc5c491a47413a8e8000447889093c2.png","name":"Xsolla Minigun","quantity":1,"sku":"com.xsolla.minigun_1","type":"virtual_good"}],"date_end":"2026-04-15T16:16:00+03:00","date_start":"2020-04-15T16:16:00+03:00","discount":{"percent":"50.00"},"name":"Bonus promotion"}],"quantity":123,"sku":"com.xsolla.booster_mega_1","type":"virtual_good","virtual_item_type":"consumable","virtual_prices":[],"vp_rewards":[{"amount":130,"image_url":"https://cdn3.xsolla.com/img/misc/images/54c0cf9d345817cdacfdde198db178e0.jpg","item_id":175232,"name":"Value point","sku":"com.xsolla.value_point_1"},{"amount":50,"image_url":"https://cdn3.xsolla.com/img/misc/images/54c0cf9d345817cdacfdde198db178e0.jpg","is_clan":true,"item_id":186321,"name":"Clan Reward VP 1","sku":"com.xsolla.clan_value_point_1"}]}]
priceobject or null

购物车价格。

示例: {"amount":"6150.0000000000000000","amount_without_discount":"6150.0000000000000000","currency":"USD"}
响应
application/json
{ "cart_id": "cart_id", "is_free": false, "items": [ {} ], "price": { "amount": "6150.0000000000000000", "amount_without_discount": "6150.0000000000000000", "currency": "USD" } }

获取促销码活动列表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/promocode?limit=50&offset=0'

响应

成功收到促销码列表。

正文application/json
active_promotions_countinteger(active_promotions_count)

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

inactive_promotions_countinteger(inactive_promotions_count)

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

itemsArray of objects(Promotions_200-get-promocode-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)
discountobject or null
示例: {"percent":"10.10"}
discounted_itemsArray of objects or null(Promotions_discounted_items)

通过促销码打折的商品列表。

excluded_promotionsArray of integers(excluded_promotions)

应用此促销活动时要排除的促销活动ID列表。
Example:[12, 789]

示例: [12,789]
external_idstring(Promotions_coupon-external_id)必需

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

默认值 "coupon_external_id"
示例: "coupon_external_id"
item_price_conditionsArray of objects or null(item_price_conditions_promocode)

包含条件的对象数组,用于设置对购物车中某些商品应用促销活动的价格范围。
将用户购物车中每个商品的价格与条件中指定的价格范围进行比较。将只对购物车中价格满足条件的商品应用奖励折扣
如果传递此数组,请将discounted_items数组的值设置为null

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附加属性
price_conditionsArray of objects or null(price_conditions_promocode)

包含条件的对象数组,用于设置对整个购物车应用促销活动的价格范围。
将用户购物车中所有商品的总价与条件中指定的价格范围进行比较。如果购物车的价格满足指定的条件,则将对购物车中的所有商品应用奖励折扣
如果传递此数组,请将discounted_items数组的值设置为null

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/promocode \
  -H 'Content-Type: application/json' \
  -d '{
    "attribute_conditions": [
      {
        "attribute": "account_status",
        "can_be_missing": false,
        "operator": "eq",
        "type": "string",
        "value": "golden"
      }
    ],
    "discount": {
      "percent": "10.10"
    },
    "external_id": "coupon_external_id",
    "name": {
      "de-DE": "Neujahrsrabatt",
      "en-US": "New Year Discount"
    },
    "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可让您针对用户属性指定规则。如果用户满足具体规则的所有条件,则会显示个性化商品。

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

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

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