Points Development Guide
Updated: 2025-06-09 14:49:29
Description
1、与用户的积分系统对接,实现积分打赏、积分红包功能。
2、参照本文档提供的积分查询接口和积分更新接口,配置在POLYV后台的设置,使用系统生成的观看链接,配合外部授权、自定义授权或者白名单观看条件使用(目前在无限制观看条件和只有验证码观看条件时不能使用),观众在看直播时可消耗积分并打赏给主播。
Points Query API
API Description
1、保利威服务器通过传递观众的id和频道号等参数,对用户的积分查询接口URL 进行请求,获取学员在平台的积分
Request Method
GET
API Constraints
- If the Points Query API URL you set contains parameters, the live streaming system will include these parameters when calling the API, and these parameters will be used in the sign concatenation and encryption process.
Request Parameters Description
Note: Parameters are passed via Query.
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| viewerId | String | Viewer ID |
| viewerName | String | Viewer nickname |
| sessionId | String | Live session ID, may be empty when not live |
| ts | Long | Current 13-digit millisecond timestamp |
| appId | String | POLYV live account appId |
| sign | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See Signature Generation Rules for details. |
Response Parameters Description
| Parameter Name | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure |
| status | String | Response status text, "success" indicates success |
| message | String | Response description. Note: When a request error occurs, the prompt displayed on the page is the one set in the POLYV points tipping configuration. |
| data | Float | Viewer's points on successful request |
Response Example
Successful Example
{
"code":200,
"status":"success",
"message":"",
"data":100.00
}
Error Example
Request failed:
{
"code":403,
"status":"error",
"message":"相关错误信息",
"data":null
}
Error Example
Insufficient points:
{
"code":400,
"status":"error",
"message":"相关错误信息",
"data":null
}
Server Example Request
http://abc.com?viewerName=保利威-式廓告&viewerId=sadboy-7t8tuo&appId=frlr1zazn3&sign=18C0CB41C5D42DF2B782F2578350B1FC&sessionId=gd1mz4kqqi&channelId=2272655&ts=1665373665677
Points Update API
API Description
1、观众观看页选择了相应道具进行打赏时,请求积分更新接口URL修改在平台的积分
2、观众观看页领取了积分红包时,请求积分更新接口URL修改在平台的积分
3、注意:积分红包、任务奖励外部积分,积分更新请求体格式为appilcation/json
Request Method
POST
API Constraints
- If the Points Update API URL you set contains parameters, the live streaming system will include these parameters when calling the API, and these parameters will be used in the sign concatenation and encryption process.
Request Parameters Description
Note: Parameters are passed via Query.
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| viewerId | String | Viewer ID |
| sessionId | String | Live session ID, may be empty when not live |
| ts | Long | Current 13-digit millisecond timestamp |
| appId | String | POLYV live account appId |
| goodName | String | Name of the tipped item |
| goodPrice | Float | Points required for the tipped item |
| goodNum | Integer | Quantity of the tipped item |
| taskId | String | Task reward task ID |
| count | Float | Total points required for this tip |
| type | String | Modification type: "increase" to add viewer points; empty value defaults to deducting viewer points |
| sign | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See Signature Generation Rules for details. |
Response Parameters Description
| Parameter Name | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure |
| status | String | Response status text, "success" indicates success |
| message | String | Response description. Note: When a request error occurs, the prompt displayed on the page is the one set in the POLYV points tipping configuration. |
| data | Float | Viewer's remaining points on successful request |
Response Example
Successful Example
{
"code":200,
"status":"success",
"message":"",
"data":100.00
}
Error Example
Insufficient points (code 400):
{
"code":400,
"status":"error",
"message":"积分不足",
"data":null
}
Request failed (code not 200 and not 400):
{
"code":403,
"status":"error",
"message":"相关错误信息",
"data":null
}
Server Example Request
http://abc.com?viewerId=sadboy-7t8tuo&goodName=皮卡丘&appId=frlr1zazn3&count=999.00&sign=6C63C4A570D63232E06E244CF0924820&sessionId=gd1mz4kqqi&goodPrice=999.00&channelId=2272655&ts=1665373695924&goodNum=1
Get Channel Available Points Limit API
API Description
1、保利威服务器通过传递appId,频道号等参数,对频道可用积分上限查询接口URL进行请求,获取频道在平台的可用积分上限
Request Method
GET
API Constraints
- If the Points Query API URL you set contains parameters, the live streaming system will include these parameters when calling the API, and these parameters will be used in the sign concatenation and encryption process.
Request Parameters Description
Note: Parameters are passed via Query.
| Parameter Name | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| ts | Long | Current 13-digit millisecond timestamp |
| appId | String | POLYV live account appId |
| sign | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See Signature Generation Rules for details. |
Response Parameters Description
| Parameter Name | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure |
| status | String | Response status text, "success" indicates success |
| message | String | Response description. Note: When a request error occurs, the prompt displayed on the page is the one set in the POLYV points tipping configuration. |
| data | Float | Channel's available points limit on successful request |
Response Example
Successful Example
{
"code":200,
"status":"success",
"message":"",
"data":100.00
}
Error Example
Request failed:
{
"code":403,
"status":"error",
"message":"相关错误信息",
"data":null
}
Error Example
Insufficient points:
{
"code":400,
"status":"error",
"message":"相关错误信息",
"data":null
}
