Skip to main content

WeChat API Analysis

By default, the Agent monitors the number of calls, success, and failure counts for the requestPayment, scanCode, and previewImage WeChat APIs. For the payment API, it also monitors cancellations. You can specify the APIs you want to monitor in the Agent initialization configuration using hookApis (do not include the wx. prefix).

Note:

  • For the request API, it is monitored by a separate request module, and this configuration will be ignored here.
  • Custom monitored APIs can only monitor success and failure counts if they provide success and fail callbacks; otherwise, only the call count can be monitored.

Example (monitor only the requestPayment API):

const monitor = require('./agent/tingyun-mp-agent.js');
monitor.config({
...,
hookApis: ['requestPayment']
})