微信小程序支付

(1)支付要素:appId、merchantId(商家标志)、openId(用户标志)、totalFee(支付金额)。

(2)openId获取方式

小程序登陆wx.login(),获取临时登录凭证code,有效期五分钟,只能使用一次。

登陆凭证校验,获取open_id和session_key。  open_id永久有效,session_key有有效期。

地址:

      小程序登陆接口     https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html

      登陆校验接口        https://developers.weixin.qq.com/miniprogram/dev/api-backend/auth.code2Session.html

(3)统一下单   https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_1       

        获取  prepay_id。该值有效期为2小时

(4)再次签名

        https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3

(5)调起收银台

   

原文地址:https://www.cnblogs.com/DengGao/p/10764439.html