# UnionID Dxplaination of the mechanism

If the developer has multiple mobile applications, website applications, and public accounts (including Mini Programs), it can be accessed through the UnionID To distinguish the uniqueness of the user, because as long as it is a mobile application, website application and public account (including mini programs) under the same WeChat open platform account, the user's UnionID It's the only one. In other words, the same user, for different applications under the same WeChat open platform, the UnionID is the same.

# UnionID Access

The Mini Program that binds the developer account can be obtained through the following ways UnionID。

  1. Developers can do so directly through the wx.login + code2Session Get to that user. UnionID, without user authorization.

  2. When the Mini Program side calls the cloud function, you can pass the Cloud.getWXContext Obtain UnionID。

  3. After the user completes the payment in the Mini Program (temporarily does not support small games), the developer can directly send the payment through thegetPaidUnionIdInterface to get the user's UnionID, without user authorization. Note: This interface is only valid for 5 minutes after the user's payment is completed, please deal with it properly.

# WeChat open platform binding Mini Program process

log inWeChat Open Platform Management Centre Mini Program Binding Mini Program

img