# 微信支付处理流程
1.微信固定连接地址如下: (在微信客户端打开,微信自动获取code然后携带code参数跳转到freelog服务端处理) https://open.weixin.qq.com/connect/oauth2/authorize? appid=wx5179c4b6bbe0cc55&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_base&state={state}#wechat_redirect
2.参数redirectUri构建 正式环境: encodeURIComponent('https://api.freelog.com/v3/transactions/wechat/codeHandle') 测试环境: encodeURIComponent('https://api.testfreelog.com/v3/transactions/wechat/codeHandle')
3.参数state构建 encodeURIComponent("a=1&b=2&c=3") 其中a=1&b=2&c=3需要微信支付调用方换算成自己真实的业务参数: 例如contractId=63c0cc74cfa72d0039c7d3a2&eventId=a2da448a
4.服务端通过code参数换取openId之后跳转到前端处理地址 正式环境: https://payment-wechat.freelog.com?openId=${openId}&${decodeURIComponent(state)} 测试环境: https://payment-wechat.testfreelog.com?openId=${openId}&${decodeURIComponent(state)}
5.前端支付处理页面根据参数调用微信预支付接口获取payInfo,然后通过微信sdk唤起微信原生支付界面; 等待用户做交易操作;