Files
ClassContent/历届学生/front-end-team-11/项目开发/上课项目/shop/笔记.txt
2024-09-27 02:06:13 +08:00

129 lines
3.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

RSA 非对称 加密
支付
https
明文 { id: 1, name: '你好' }
公钥
私钥
Vuex: 存放全局方法和变量的地方
状态管理
State: 类似data,来存储全局变量的地方
Getter:读 State 存的数据
Mutation:写 State 存的数据
Action:执行异步方法
支付:
微信支付 https://pay.weixin.qq.com/wiki/doc/api/index.html
小程序:
1 下单: /playOrder
参数:
商品id [45,57,42,78]
支付方式 1 2 3
响应:{
timeStamp: '',
nonceStr: '',
package: '',
signType: 'MD5',
paySign: '',
}
订单号
2 wx.requestPayment(1的响应)
success (res) {
// 支付成功
},
fail (res) {
// 支付成功
}
JSAPI支付(公众号)
1 同上
响应:{
"appId":"wx2421b1c4370ec43b", //公众号ID,由商户传入
"timeStamp":"1395712654", //时间戳,自1970年以来的秒数
"nonceStr":"e61463f8efa94090b1f366cccfbbb444", //随机串
"package":"prepay_id=u802345jgfjsdfgsdg888",
"signType":"MD5", //微信签名方式:
"paySign":"70EA570631E4BB79628FBCA90534C63FF7FADD89" //微信签名
}
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
"appId":"wx2421b1c4370ec43b", //公众号ID,由商户传入
"timeStamp":"1395712654", //时间戳,自1970年以来的秒数
"nonceStr":"e61463f8efa94090b1f366cccfbbb444", //随机串
"package":"prepay_id=u802345jgfjsdfgsdg888",
"signType":"MD5", //微信签名方式:
"paySign":"70EA570631E4BB79628FBCA90534C63FF7FADD89" //微信签名
},
function(res){
if(res.err_msg == "get_brand_wcpay_request:ok" ){
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
}
});
H5支付
1 同上
响应: url
2 查询支付状态 订单号
PC支付
1 同上
响应:收款二维码的图片地址 订单号
2 使用定时器 每隔1秒 拿着订单号去调接口,问后端用户是否支付成功
支付宝支付 https://open.alipay.com/
小程序
1 同上
响应: 订单号
2
my.tradePay({
// 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号trade_no
tradeNO: '201711152100110410533667792',
success: (res) => {
my.alert({
content: JSON.stringify(res),
});
},
fail: (res) => {
my.alert({
content: JSON.stringify(res),
});
}
});
PC网页支付
1 同上
响应:
支付宝官方收款的网址 https://excashier.alipay.com/standard/auth.htm?payOrderId=订单id
表单
<form action="https://excashier.alipay.com/standard/auth.htm?payOrderId=订单id" method="get">
<input type="submit" value="提交">
</form>
支付完后,会跳转到 你配置的那个网址
支付状态页面 ?payOrderId=dddddd
原页面
银联支付