受欢迎的博客标签

step 1:新建云函数pay

 

step 2. 加入wx-js-utils库

在package.json中加入对wx-js-utils库的引用,云函数上传后,云端会自动加载wx-js-utils库

{
  "name": "payment",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "wx-server-sdk": "latest",
    "wx-js-utils": "1.0.0"
  }
}

工程项目:

https://github.com/lcxfs1991/wx-js-utils

blog:

https://blog.csdn.net/qiushi_1990/article/details/90289901

使用源码

https://github.com/rhinocerosTeam/taro-components/blob/bf0724410a64d59df5fdf2fed4aaa3b984d17683/cloud/functions/pay/index.js