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

Code Scanning

PDF
Focus Mode
Font Size
Last updated: 2025-04-10 18:18:36

scanCode

This API is called using wx.scanCode(Object object).
Notes:
This API is supported in mini programs but not in mini games.
Feature description:Opens the client’s code scanning interface to scan the code.
Parameter and description:Object object.
Property
Type
Valid values and description
Default value
‍Required
Description
onlyFromCamera
boolean
-
false
False
Whether to only allow scanning from the camera, not from the photo album.
scanType
Array.<string>
barCode: Barcode
qrCode: QR code
datamatrix: Data Matrix code
pdf417: PDF417 barcode
['barCode', 'qrCode']
False
Types of codes to scan.
success
function
-
-
False
Callback function for successful API calls.
fail
function
-
-
False
Callback function for failed API calls.
complete
function
-
-
False
Callback function executed after API call ends (regardless of success or failure).
object.success callback function parameter:Object res.
Property
Type
Valid values and description
Description
result
string
-
Content of the scanned code.
scanType
string
QR_CODE: QR code
AZTEC: Barcode
CODABAR: Barcode
CODE_39: Barcode
CODE_93: Barcode
CODE_128: Barcode
DATA_MATRIX: QR code
EAN_8: Barcode
EAN_13: Barcode
ITF: Barcode
MAXICODE: Barcode
PDF_417: QR code
RSS_14: Barcode
RSS_EXPANDED: Barcode
UPC_A: Barcode
UPC_E: Barcode
UPC_EAN_EXTENSION: Barcode
WX_CODE: QR code
CODE_25: Barcode
Type of the scanned code.
charSet
string
-
Character set of the scanned code.
path
string
-
If the scanned code is a QR code for the current mini program, this field will be returned with the path carried by the QR code
rawData
string
-
Base64-encoded raw data.
Example:
// Allow scanning from both camera and photo album
wx.scanCode({
success (res) {
console.log(res)
}
})

// Only allow scanning from the camera
wx.scanCode({
onlyFromCamera: true,
success (res) {
console.log(res)
}
})



Help and Support

Was this page helpful?

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

Feedback