Code Monkey home page Code Monkey logo

wxcloudrun-pay-demo's Introduction

微信云托管·微信支付演示DEMO

项目介绍

此示例使用「微信云托管」微信支付实现了从付款到退款的整个闭环基础操作流程。

部署步骤

  • 将项目下载,使用小程序开发者工具导入,appid填写已认证的非个人小程序
  • 按照此指引将微信支付商户号授权给小程序,然后获得小程序绑定的子商户号。
  • 将子商户号写入 /server/index.php 第2行 $mchid 中。
  • 在「微信云托管控制台」云调用打开开放接口服务,参照此指引
  • 将项目下 /server/pay 文件部署到微信云托管中,服务名称为pay;具体可以参照此指引中的部署步骤。
  • 获取上一步部署的微信云托管服务名称,以及环境ID,填入 /miniprogram/pages/index/index.js 的154行。
  • 完成。

技术原理

  • 服务端使用微信云托管开放接口服务,免令牌
  • 客户端使用本地存储来维护订单的持久性
  • 支付相关的接口都是使用最简易的输入,扩展数据需要自行开发
  • 为了防止用户恶意请求,使用header头 x-wx-source 来判断微信真实来源

注意事项

  • 本项目只是用于演示,所以接口直接对应支付事项,仅用于代码交流
  • 如果你要开发业务,请结合自身业务逻辑自行拼接订单业务
  • 如果你想更改服务名称,需要注意在 /miniprogram/pages/index/index.js 的158行、/server/index.php 的30、59行更改服务名称。

作者信息

  • zirali

wxcloudrun-pay-demo's People

Contributors

wxcloudbase avatar

Stargazers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.