多个小程序互通数据后,微信支付报appId与OpenId不一致

微信支付 文章 2021-03-17 20:01 0 23 全屏看文

多个小程序互通数据后,微信支付报appId与OpenId不一致After multiple applets exchange data, WeChat Pay reports that appId is inconsistent with OpenId

多个小程序互通数据后,微信支付报appId与OpenId不一致

由于小程序的功能过于繁杂,上级让我们将小程序根据sass拆分成多个小程序

这多个小程序之间的数据要互通,用户表也是同一个用户

我们在数据库的用户表里存储了用户的openId

现在出现了一个问题:当从小程序A调到小程序B的时候,会进行一次授权登陆,授权登陆会改变用户表存储的openId。授权登陆小程序B后再回小程序A走支付功能,由于现在表存储的是小程序B的openId,发起下单接口时,提示小程序A的appId和 openId对不上

对于这种情况,有什么解决方案?

Because the function of the small program is too complicated, the superior asked us to split the small program into several small programs according to sass. The data between these small programs should be exchanged, and the user table is also the same user. We stored the user's openid in the user table of the database Now there is a problem: when small program a is transferred to small program B, an authorized login will be performed, and the authorized login will change the openid stored in the user table. After logging in to applet B, you can go back to applet a for payment function. Since the table now stores the openid of applet B, when you initiate the order interface, you will be prompted that the appid and openid of applet a are not matched. What is the solution to this situation?

回答:

peng:

每个小程序对应的openid是不同的,注册开放平台(open.weixin.qq.com)用到的小程序绑上去,wx.login会获取到unionid,这个针对用户是唯一,你们用户主表可以存unionid,加个子表记录小程序appid,和对应的openid。支付可以时可以根据从哪个appid发起取对应的openid.

老张:

谢邀。

具体你怎么弄,你随便。

只要统一下单填的openid与调用wx.requestPayment的用户的openid是同一个就行了。

Memory:

不要存储openid,发起支付的商户要重新获取

Eric:

使用unionid 打通用户

-EOF-