Query the usage of a purchased resource pack

View Markdown

Last edited on 2026-03-16

This API should be called on the server side and cannot be called directly on the client side (Mini Program, web page, APP, etc.). For details, please refer to API Call Guide.

API English Name: getUsageDetail

Mini Program can use this API to query the usage of purchased resource packs.

1. Call Method

HTTPS Call

GET https://api.weixin.qq.com/wxa/charge/usage/get?access_token=ACCESS_TOKEN

Cloud Call

  • This API does not support cloud call.

Third-party Call

  • This API supports third-party platforms on behalf of Merchant call.

  • The permission set ID of this API is: 18

  • After the service provider obtains one of the permission set authorizations, it can use authorizer_access_token to call on behalf of Merchant, for details please refer to Third-party Call documentation.

2. Request Parameters

Query Parameters Query String Parameters

ParameterTypeRequiredExampleDescription
access_tokenstringYesACCESS_TOKENAPI call credential, you can use access_token, authorizer_access_token

Request Body Request Payload

ParameterTypeRequiredDescription
spuIdstringYesProduct SPU ID
offsetnumberYesPagination offset, starting from 0
limitnumberYesNumber of items per page, maximum 20

3. Response Parameters

Response Body Response Payload

ParameterTypeDescription
errcodenumberError code
errmsgstringError message
effectiveUsestringCumulative usage (64-bit integer), used for resource pack products
effectiveAllstringTotal resource volume (64-bit integer), used for resource pack products (deprecated)
allstringTotal available resource volume (64-bit integer), used for resource pack products. See Additional Notes for details
startServiceTimenumberSubscription start timestamp (in seconds), used for subscription products
endServiceTimenumberSubscription end timestamp (in seconds), used for subscription products
totalnumberTotal number of items in the usage details list
detailListobjarrayUsage details list

Res.detailList(Array) Object Payload

Usage details list

ParameterTypeDescriptionEnum
pkgIdstringResource pack ID-
statusnumberResource pack statusEnum Values
startTimenumberQuota validity start timestamp (in seconds)-
endTimenumberQuota validity end timestamp (in seconds)-
allstringQuota capacity (64-bit integer)-
usedstringUsed quota (64-bit integer)-
spuIdstringSPU ID of the product from which the quota originated (64-bit integer)-
skuIdstringSKU ID of the product from which the quota originated (64-bit integer)-
sourcenumberQuota sourceEnum Values

4. Enum Information

Res.detailList(Array).status Enum

Resource pack status

Enum ValueDescription
1Active
2Inactive
3Expired

Res.detailList(Array).source Enum

Quota source

Enum ValueDescription
1Trial quota
2Paid purchase
3Allocated by Service Provider
4Other
5Other

5. Notes

Additional Notes

Specific meaning of the all field:

During the normal billing period for each paid capability: The total volume of currently effective resource packs (same as the original effectiveAll; the original field is deprecated). During the pre-announcement billing period before formal billing starts for each paid capability: The total volume of currently effective resource packs and resource packs purchased but not yet effective.

6. Code Example

Request Example

GET https://api.weixin.qq.com/wxa/charge/usage/get?access_token=ACCESS_TOKEN&spuId=10000001&offset=0&limit=10

Response Example

{
  "errcode": 0,
  "all": "10",
  "effectiveAll": "10",
  "effectiveUse": "0",
  "startServiceTime": 1669129510,
  "endServiceTime": 1709450190,
  "total": 2,
  "detailList": [
    {
      "pkgId": "ZY2823973277692477440",
      "startTime": 1677914190,
      "endTime": 1709450190,
      "used": "0",
      "all": "4",
      "status": 1,
      "spuId": "10000057",
      "skuId": "20000059"
    },
    {
      "pkgId": "ZY2676590816357400576",
      "startTime": 1669129510,
      "endTime": 1700665510,
      "used": "0",
      "all": "6",
      "status": 1,
      "spuId": "10000057",
      "skuId": "20000060"
    }
  ]
}

7. Error Codes

The following is the error code list of this API, other error codes can refer to Common Error Codes; When encountering errors in calling the API, you can use the official API Diagnostic Tool to assist in locating and analyzing problems.

Error CodeError Description
10120002Invalid parameter
10120003The `limit` parameter value is too large. Reduce the value of `limit`.

8. Applicable Scope

This API supports 「Mini Program」 account type calls. Other account types cannot call unless otherwise specified.