Polyv Help Center

Help Center

Get Account Points Donation Settings

Updated: 2022-09-02 18:08:07

Interface URL

http://api.polyv.net/live/v3/channel/donate/get-point-setting

Interface Description

1. Retrieves the points donation settings for the account's general settings. If a channelId is submitted, the interface also returns the channel's points donation toggle setting.
2. The channel's points donation toggle takes effect only when the general settings' points donation is also enabled.
3. HTTPS is supported.

Supported Format

JSON

Request Method

GET

Request Parameters

Parameter Required Type Description
appId Yes string The appId under the account application
timestamp Yes string Current time in milliseconds (13 digits)
sign Yes 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 relayed through the customer's own server to the POLYV server for response data. See signature generation rules
channelId No int Whether to query the channel's settings

Successful Response Example

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "userId": "edvf2fpec9",
        "donatePointEnabled": "N",
        "channelDonatePointEnabled": null,
        "queryPointUrl": null,
        "updatePointUrl": null,
        "requestFailTips": "积分异常,请稍后重试",
        "pointNotEnoughTips": "积分不足,无法打赏",
        "pointUnit": "点",
        "goods": [
            {
                "goodName": "鲜花",
                "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/01-flower.png",
                "goodPrice": 0.00,
                "goodEnabled": "Y"
            },
            {
                "goodName": "咖啡",
                "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/02-coffee.png",
                "goodPrice": 5.00,
                "goodEnabled": "Y"
            },
            {
                "goodName": "点赞",
                "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/03-good.png",
                "goodPrice": 10.00,
                "goodEnabled": "Y"
            },
            {
                "goodName": "掌声",
                "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/04-applaud.png",
                "goodPrice": 15.00,
                "goodEnabled": "Y"
            },
            {
                "goodName": "666",
                "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/05-666.png",
                "goodPrice": 20.00,
                "goodEnabled": "Y"
            },
            {
                "goodName": "小星星",
                "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/06-star.png",
                "goodPrice": 25.00,
                "goodEnabled": "Y"
            },
            {
                "goodName": "钻石",
                "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/07-diamond.png",
                "goodPrice": 30.00,
                "goodEnabled": "Y"
            },
            {
                "goodName": "跑车",
                "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/08-car.png",
                "goodPrice": 50.00,
                "goodEnabled": "Y"
            },
            {
                "goodName": "火箭",
                "goodImg": "//livestatic.videocc.net/uploaded/images/webapp/channel/donate/09-rocket.png",
                "goodPrice": 100.00,
                "goodEnabled": "Y"
            }
        ]
    }
}

Failed Response Example

Signature error

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

Response Field Description

Name Type Description
code string Response code: 200 for success, 400 for failure, 403 for signature error, 500 for exception error
status string success for success, error for failure
message string Error message when an error occurs
data object Successful response data
donatePointEnabled string Points donation toggle setting, values: Y/N
channelDonatePointEnabled string Channel's points donation toggle setting, values: Y/N/null. Only when donatePointEnabled=Y and channelDonatePointEnabled=Y, the channel enables points donation settings
queryPointUrl string API to get viewer points
updatePointUrl string API to update viewer points
requestFailTips string Error prompt when API request fails
pointNotEnoughTips string Prompt when donation points are insufficient
pointUnit string Unit of points
goods object[] List of points donation items
goods[].goodName string Item name
goods[].goodImg string Item image
goods[].goodPrice float Item price
goods[].goodEnabled string Item toggle, values: Y/N

PHP Request Example

<?php
//引用config.php
include 'config.php';

$params = array(
    'appId' => $appId,
    'timestamp' => $timestamp
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;

//接口请求url
$url = "`https://api.polyv.net/live/v3/channel/donate/get-point-setting?appId=".$appId."&sign=".$sign."&timestamp=".$timestamp;
//输出接口请求结果
echo file_get_contents($url);
?>
联系客服,在线咨询