tencent cloud

Tencent Cloud Super App as a Service

Release Notes and Announcements
Announcement: Tencent Cloud Mini Program Platform Renamed to Tencent Cloud Super App as a Service on January 2, 2025
Console Updates
Android SDK Updates
iOS SDK Updates
Flutter SDK Updates
IDE Updates
Base Library Updates
Product Introduction
Overview
Strengths
Use Cases
Purchase Guide
Billing Overview
Pay-As-You-Go Billing
Renewal Guide
Service Suspension Instructions
Getting Started
Plan Management
Overview
Console Account Management
Storage Configuration
Acceleration Configuration
Branding Configurations
Platform Features
Console Login
Users and Permission System
Mini Program Management
Mini Game Management
Superapp Management
Commercialization
Platform Management
User Management
Team Management
Operations Management
Security Center
Code Integration Guide
Getting Demo and SDK
Android
iOS
Flutter
Superapp Server
GUID Generation Rules
Mini Program Development Guide
Mini Program Introduction and Development Environment
Mini Program Code Composition
Guide
Framework
Components
API
Server Backend
JS SDK
Base Library
IDE Operation Instructions
Mini Game Development Guide
Guide
API
Server Backend
Practice Tutorial
Mini Program Login Practical Tutorial
Mini Program Subscription Message Practical Tutorial
Payment Practical Tutorial
Ad Integration Practical Tutorial
Mini Game Subscription Message Practical Tutorial
API Documentation
History
Introduction
API Category
Making API Requests
Operation Management APIs
User Management APIs
Team Management APIs
Sensitive API-Related APIs
Role Management APIs
Platform Management APIs
Other Console APIs
Mini Program or Mini Game APIs
Management-Sensitive APIs
Global Domain Management APIs
Superapp APIs
Data Types
Agreements
Service Level Agreement
Data Processing and Security Agreement
SDK Privacy Policy Module
SDK Data Processing and Security Agreement Module

Open APIs

PDF
Focus Mode
Font Size
Last updated: 2025-12-05 22:26:28
The mini program SDK provides some open APIs for implementing features that are provided by superapps, such as login, user information retrieval, and payment.
Note:
The open APIs currently provide three implementation solutions:
v1: Fully customized by the superapp, and all open APIs must be implemented by superapp developers.
v2: Starting from SDK version 2.1.0, the SDK provides default implementations for login (wx.login), user information (wx.getPhoneNumber, wx.getEmail, wx.chooseAvatar, wx.getNickName), and session checks (wx.checkSession). Users can easily configure these to link the mini program user login with superapp user information.

API description

Mini program method
TMFMiniAppSDKDelegate implementation method
Description
Default implementation
wx.login
login
Login API SDK
The default implementation (v2) is available starting from version 2.1.0.
wx.getPhoneNumber
getPhoneNumber
Retrieves the phone number
The default implementation (v2) is available starting from version 2.1.0.
wx.getEmail
getEmail
Retrieves the user email
The default implementation (v2) is available starting from version 2.1.0.
wx.checkSession
checkSession
Checks if the login session has expired
The default implementation (v2) is available starting from version 2.1.0.
wx.chooseAvatar
chooseAvatar
Retrieves the user profile photo
The default implementation (v2) is available starting from version 2.1.0.
wx.getNickName
getNickName
Retrieves the user nickname
The default implementation (v2) is available starting from version 2.1.0.
wx.getUserInfo
getUserInfo
Retrieves the basic user information
No default implementation
wx.getUserProfile
getUserProfile
Retrieves the user profile information
No default implementation
wx.requestPayment
requestPayment
Initiates a payment
No default implementation
wx.requestMidasPaymentGameItem
requestMidasPaymentGameItem
Mini game payment
No default implementation
wx.requestVirtualPayment
requestVirtualPayment
Virtual payment in mini programs
No default implementation

Related APIs in the delegate class

// Initiates a payment
// @param app Mini program/mini game instance
// @param params Parameters
// @param completionHandler Callback with result
- (void)requestPayment:(TMFMiniAppInfo *)app params:(NSDictionary *)params completionHandler:(MACommonCallback)completionHandler;

// Initiate a payment for a direct virtual item purchase
// @param app Mini game instance
// @param params Parameters
// @param completionHandler Callback with result
- (void)requestMidasPaymentGameItem:(TMFMiniAppInfo *)app params:(NSDictionary *)params completionHandler:(MACommonCallback)completionHandler;

// Initiate virtual payment for mini props
// @param app Mini program/mini game instance
// @param params Parameters
// @param completionHandler Callback with result
- (void)requestVirtualPayment:(TMFMiniAppInfo *)app params:(NSDictionary *)params completionHandler:(MACommonCallback)completionHandler;

Login
// @param app Mini program/mini game instance
// @param params Parameters
// @param completionHandler Callback with result
- (void)login:(TMFMiniAppInfo *)app params:(NSDictionary *)params completionHandler:(MACommonCallback)completionHandler;

// checkSession
// @param app Mini program/mini game instance
// @param params Parameters
// @param completionHandler Callback with result
- (void)checkSession:(TMFMiniAppInfo *)app params:(NSDictionary *)params completionHandler:(MACommonCallback)completionHandler;

// getUserProfile
// @param app Mini program/mini game instance
// @param params Parameters
// @param completionHandler Callback with result
- (void)getUserProfile:(TMFMiniAppInfo *)app params:(NSDictionary *)params completionHandler:(MACommonCallback)completionHandler;


// getPhoneNumber
// @param app Mini program/mini game instance
// @param params Parameters
// @param completionHandler Callback with result
- (void)getPhoneNumber:(TMFMiniAppInfo *)app params:(NSDictionary *)params completionHandler:(MACommonCallback)completionHandler;

// getUserInfo
// @param app Mini program/mini game instance
// @param params Parameters
// @param completionHandler Callback with result
- (void)getUserInfo:(TMFMiniAppInfo *)app params:(NSDictionary *)params completionHandler:(MACommonCallback)completionHandler;

// OpenAPI version
// @param app Mini program/mini game instance
// @reutn v1/v2
- (NSString *)openApiVersion:(TMFMiniAppInfo *)app;

Implementation description

Superapp developers can implement the open API logic by overriding the proxy implementation of MiniOpenApiProxy.

Implementation description for v1

All APIs in v1 must be implemented by superapp developers.

Example


- (void)getUserInfo:(TMFMiniAppInfo *)app params:(NSDictionary *)params completionHandler:(MACommonCallback)completionHandler {
if (completionHandler) {
completionHandler();
@"nickName": [DemoUserInfo sharedInstance].nickName,
@"avatarUrl": [DemoUserInfo sharedInstance].avatarUrl,
@"gender": [NSNumber numberWithUnsignedInt:[DemoUserInfo sharedInstance].gender],
@"country": [DemoUserInfo sharedInstance].country,
@"province": [DemoUserInfo sharedInstance].province,
@"city": [DemoUserInfo sharedInstance].city,
@"language": 'zh-cn':{
(nil)
}
}

- (void)getUserProfile:(TMFMiniAppInfo *)app params:(NSDictionary *)params completionHandler:(MACommonCallback)completionHandler {
if (completionHandler) {
completionHandler();
@"nickName": [DemoUserInfo sharedInstance].nickName,
@"avatarUrl": [DemoUserInfo sharedInstance].avatarUrl,
@"gender": [NSNumber numberWithUnsignedInt:[DemoUserInfo sharedInstance].gender],
@"country": [DemoUserInfo sharedInstance].country,
@"province": [DemoUserInfo sharedInstance].province,
@"city": [DemoUserInfo sharedInstance].city,
@"language": 'zh-cn':{
(nil)
}
}

Implementation description for v2

After logging into the superapp, the obtained UID (the current user account identifier in the superapp) must be returned to the SDK engine via the delegate API. For example, if the UID is stored in [DemoUserInfo sharedInstance].userId after login, the delegate method can be implemented as follows:
- (NSString *)getAppUID {
return [DemoUserInfo sharedInstance].userId;
}

Compatibility of custom login logic

Starting with SDK version 2.2.10, the SDK interface can be implemented with v1 by superapp via interface configuration on top of the v2 default implementation.
// OpenAPI version
// @param app Mini program/mini game instance
// @reutn v1/v2
- (NSString *)openApiVersion:(TMFMiniAppInfo *)app;
Note:
Mini program developers can use the apiVersion field in app.json to control versions for APIs that are implemented by default in SDK versions later than 2.1.0. When this field is not set, the version follows the value returned by the delegate API's openApiVersion method. Once configured, the API version matches the configured one. In other words,
The apiVersion configuration has higher priority than the value returned by the openApiVersion delegate method.
(For example, if apiVersion is set to v2, all APIs will use the v2 implementation exclusively. Version mixing is not supported; even if openApiVersion returns a different value, the SDK will use the v2 implementation.)

Example:

- (NSString *)openApiVersion:(TMFMiniAppInfo *)app {
// This superapp uses the v2 version of the openAPI
return @"v2";
}

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback