zl程序教程

您现在的位置是:首页 >  其他

当前栏目

微信企业号开发:企业支付openid的获取 appid and openid not match详解手机开发

企业微信手机开发 详解 获取 not and
2023-06-13 09:20:12 时间

openid是微信支付的一个必要参数,但官方的demo里针对的都是公众号,企业号的如何获取呢?

基本的原理都是根据code获取到对应微信用户的openid,分成三步

1调用的接口为https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=ACCESS_TOKEN code=CODE

官方文档参考

非企业用户直接返回openID,企业用户时不返回openid!!


2但企业用户会返回UserId,需要userid与openid互换


需要进一步调用接口https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_openid?access_token=ACCESS_TOKEN

官方文档参考

3在调用userid与openid互换互换接口时,有一个细节需要注意。

  传递的参数agentid

agentid需要分成两种类型,一种情况这个参数必须传递,一种一定不要传递,否则就会出现错误
在调用UnfiedOrder接口时,返回如下错误:
UnfiedOrder response : 

xml return_code ![CDATA[FAIL]] /return_code
return_msg ![CDATA[appid and openid not match]] /return_msg
/xml

其实也就是说在调用https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_openid?access_token=ACCESS_TOKEN

这个接口时有没有参数agenti适用于不同的情况,会返回不同的openid


https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_openid?access_token=ACCESS_TOKEN


微信企业号开发:企业支付openid的获取 appid and openid not match详解手机开发




5290.html

app程序应用开发手机开发无线开发移动端开发