Polyv Help Center

Help Center

Get Bill List

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

API URL

http://api.polyv.net/live/v3/finance/bill/list

API Description

Paginated retrieval of account daily bill list.
API supports HTTPS.

Request Method

GET

Request Parameters

Parameter Required Type & Range Description
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 never 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 and obtain response data. For details, see Signature Generation Rules.
appId Yes string The appId under the developer account.
timestamp Yes string Current timestamp in 13-digit milliseconds.
type No string Bill type: live (cloud live streaming), mic (mic connection). Default: live.
page No int Page number.
pageSize No int Number of items per page.
startDay No string Start date, format: YYYY-MM-DD.
endDay No string End date, format: YYYY-MM-DD.

Example of Successful JSON Response

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "pageSize": 2,
        "pageNumber": 1,
        "totalItems": 78,
        "contents": [
            {
                "userId": "ee7fe7fbda",
                "inmonth": "2020-03",
                "currentDay": "2020-03-25",
                "total": 1,
                "billingType": "duration",
                "email": "moshunwei@polyv.net",
                "unit": "分钟",
                "consumerType": "后付费",
                "productType": "云直播"
            },
            {
                "userId": "ee7fe7fbda",
                "inmonth": "2020-03",
                "currentDay": "2020-03-24",
                "total": 40,
                "billingType": "duration",
                "email": "moshunwei@polyv.net",
                "unit": "分钟",
                "consumerType": "后付费",
                "productType": "云直播"
            }
        ],
        "startRow": 1,
        "firstPage": true,
        "lastPage": false,
        "nextPageNumber": 2,
        "prePageNumber": 1,
        "limit": 2,
        "totalPages": 39,
        "endRow": 2,
        "offset": 0
    }
}

Example of Failed JSON Response:

appId not provided

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

Incorrect appId

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

Timestamp error

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

Signature error

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

Invalid bill type

{
    "code": 400,
    "status": "error",
    "message": "invalid bill type",
    "data": ""
}

Field Description

Field Type & Range Description
code int API request status code, 200 indicates success.
status string API request status, "success" indicates success.
message string Error message returned on request failure.
data Paginator Paginated bill results.

Data Object Field Description

Paginator

Description: Paginated results of bill records.

Field Type & Range Description
pageNumber int Current page number.
totalItems int Total number of records.
firstPage boolean Whether it is the first page, value: true/false.
lastPage boolean Whether it is the last page, value: true/false.
nextPageNumber int Next page number.
prePageNumber int Previous page number.
totalPages int Total number of pages.
startRow int Position of the first record on the current page within the total records.
endRow int Position of the last record on the current page within the total records.
limit int Number of records on the current page.
contents List List of bills.
BillDailyModel

Description: Bill record.

Field Type & Range Description
userId string User userId.
inmonth string Billing period.
currentDay string Consumption date.
total int Usage minutes, unit: minutes.
billingType string Bill type: live (cloud live streaming), mic (mic connection).
email string Email address.
unit string Unit.
consumerType string Billing item.
productType long Product item.

PHP Request Example

<?php

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

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

//生成sign
$sign = getSign($params); //详细查看config.php文件
$params['sign'] = $sign;
$url="http://api.polyv.net/live/v3/finance/bill/list?".http_build_query($params);
echo "<script>window.location.href='$url'</script>";
?>
联系客服,在线咨询