Skip to main content
Version: Next

Taro.chooseAddress(option)

Gets the recipient address. This API opens the native UI for the user to edit the recipient address and returns to the selected address after the editing is completed.

Reference

Type

(option?: Option) => Promise<SuccessCallbackResult>

Parameters

Option

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

SuccessCallbackResult

PropertyTypeDescription
userNamestringRecipient name
provinceNamestringTier-1 address of national standard recipient address
cityNamestringTier-2 address of national standard recipient address
countyNamestringTier-3 address of national standard recipient address
detailInfostringDetailed recipient address
postalCodestringPost code
nationalCodestringCountry code of the recipient address
telNumberstringMobile number of the recipient
errMsgstringError message

Sample Code

Taro.chooseAddress({
success: function (res) {
console.log(res.userName)
console.log(res.postalCode)
console.log(res.provinceName)
console.log(res.cityName)
console.log(res.countyName)
console.log(res.detailInfo)
console.log(res.nationalCode)
console.log(res.telNumber)
}
})

API Support

APIWeChat Mini-ProgramH5React Native
Taro.chooseAddress✔️