tencent cloud

Tencent Cloud Super App as a Service

文档Tencent Cloud Super App as a Service

Open APIs

下载
聚焦模式
字号
最后更新时间: 2026-01-29 00:28:08
The mini program SDK provides a set of open APIs that allow calling and implementing capabilities provided by the superapp, such as login, user information retrieval, and payment. The currently supported open APIs are listed in the table below:
Mini program method
MiniOpenApiProxy method
Description
wx.login
login
Login API.
wx.getUserInfo
getUserInfo
Gets basic user information.
wx.getUserProfile
getUserProfile
Gets user profile information.
wx.getPhoneNumber
getPhoneNumber
Gets phone number.
wx.requestPayment
requestPayment
Initiates a payment.
wx.checkSession
checkSession
Checks if the login session has expired.
wx.requestVirtualPayment
requestVirtualPayment
Initiates the virtual payment.
You can associate data interactions between the mini program and the superapp by implementing the OpenApiHandler abstract class. See the example below:
abstract class OpenApiHandler {
// The API is called when the mini program calls wx.requestPayment to request a third-party payment.
Future<Map<String, dynamic>> requestPayment(
AppInfo appInfo, Map<Object?, Object?> params);

/// The API is called when the mini program calls wx.getUserProfile to request the user information of the superapp.
///
Future<Map<String, dynamic>> getUserProfile(
AppInfo appInfo, Map<Object?, Object?> params);

/// The API is called when the mini program calls wx.login to request the login certificate of the superapp.
///
Future<Map<String, dynamic>> login(
AppInfo appInfo, Map<Object?, Object?> params);

/// The API is called when the mini program calls wx.checkSession to request the login status of the superapp.
/// Check if the login has expired.
///
Future<Map<String, dynamic>> checkSession(
AppInfo appInfo, Map<Object?, Object?> params);

/// The API is called when the mini program calls wx.getUserInfo (wx.getUserInfo has been replaced by wx.getUserProfile).
/// Compatible with earlier mini program APIs.
///
Future<Map<String, dynamic>> getUserInfo(
AppInfo appInfo, Map<Object?, Object?> params);

/// The API is called when the mini program calls wx.getPhoneNumber to request the current user's phone number.
///
Future<Map<String, dynamic>> getPhoneNumber(
AppInfo appInfo, Map<Object?, Object?> params);
/// The API is called when the mini program calls wx.requestVirtualPayment to initiate the virtual payment feature.
Future<Map<String, dynamic>> requestVirtualPayment(
AppInfo appInfo, Map<Object?, Object?> params)
}
Example:
@override
Future<Map<String, dynamic>> getUserProfile(
AppInfo appInfo, Map<Object?, Object?> params) async {
print("getUserProfile:$appInfo params:$params");
Map<String, dynamic> result = {
"userInfo": {
"nickName": "xcode",
"avatarUrl":
"https://staticintl.cloudcachetci.com/cms/backend-cms/8WGP653_%E5%BC%80%E5%8F%91%E8%80%85%E5%B7%A5%E5%85%B7%E9%80%9A%E7%94%A8.png",
"gender": 1,
"country": "China",
"province": "ChongQing",
"city": "ChongQing",
}
};
return Future.value(result);
}


帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈