wx.miniapp.bindPhone

View Markdown

Last edited on 2026-03-12

iOS >= 1.0.9, Android >= 1.0.5

During the active system login session, invoke the API to bind a phone number.

Prerequisites

Use the button component with the specified open-type and sms-type to trigger the API and send an SMS verification code to the user.

Parameters

Object object

Attribute Type Default Required Description
phoneNumber string Yes Phone number
verifyCode string Yes Verification code: A string consisting of 6 pure digits
success function No Callback function invoked when the API call succeeds
fail function No Callback function invoked when the API call fails
complete function No Callback function invoked when the API call completes

object.fail Callback Function

Parameters
Object res
Attribute Type Description
errCode number Error code. 0: Request successful
errMsg string Error message

res.errCode

errCode Description
-1 system error
10001011 Invalid system login state
10001006 Incorrect verification code
10001023 Phone number already exists, binding failed
-700000 Frontend error, errMsg will provide detailed information

Sample Code

wx.miniapp.bindPhone({
	phoneNumber: 'xxx', // Phone number
	verifyCode: 'xxx', // Verification code
	success(res) {
		// Binding successful	
	}
})