WeChat Open Platform

Mini Programs Documentation

Shipping Address

wx.chooseAddress(OBJECT)

Calls the native interface where users edit shipping addresses and returns the address selected by the user after editing has been completed.

OBJECT parameter descriptions:

Parameter Type Required Returns
success Function No Returns shipping address information selected by user
fail Function No Callback function for failed interface call
complete Function No Callback function for interface call results (will be executed if call succeeds or fails)

success return parameter descriptions:

Parameter Type Description
errMsg String Call result
userName String Receiver name
postalCode String Postal code
provinceName String GB shipping address first stage address
cityName String GB shipping address second stage address
countyName String GB shipping address third stage address
detailInfo String Detailed shipping address information
nationalCode String Shipping address national code
telNumber String Receiver phone number

Sample code:

wx.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)
  }
})

Bugs & Tips

  1. tip: The wx.chooseAddress interface requires user authorization, it is a scene where compatible users are requested to decline authorization.