当前位置:网站首页>[uniapp calls wechat Payment] uniapp development applet - call wechat payment
[uniapp calls wechat Payment] uniapp development applet - call wechat payment
2022-07-18 20:28:00 【Ma Xiaotiao's coding advanced road】
Hello, everyone ~ I'm Ma Xiaotiao . An advanced program yuan .
Record every progress of your growth here , Hope to meet like-minded ape friends
Work together , Put technology together up up up!!!

Use uniapp When developing applets , The steps to call wechat payment are as follows :
One 、manifest.json Relevant parameters of internal configuration
1. stay manifest.json - App Module permission selection The admission payment( payment )
2. stay manifest.json - App SDK To configure in , Check the required payment platform , At present, wechat payment 、 Alipay pay 、 Apple in app payment (IAP), Wechat payment needs to fill in the information obtained from wechat open platform

Two 、 Wechat app payment - Code :
there timeStamp, nonceStr, package, signType, paySign It is generated by the interaction between the backend and wechat , Passed through the interface , Call the interface directly .
uni.requestPayment({
provider: 'wxpay', // Payment type - Fixed value
timeStamp: res.data.wechat.timeStamp, // Time stamp ( Company : second )
nonceStr: res.data.wechat.nonceStr, // Random string
package: res.data.wechat.package, // Fixed value
signType: res.data.wechat.signType, // Fixed value
paySign: res.data.wechat.paySign, // Signature
success: function (res) {
// console.log('success:' + JSON.stringify(res));
console.log(" Successful payment ");
uni.showToast({
icon: 'success',
title: ' Successful payment '
})
// Clear the input box
that.name = ''
that.idcard = ''
},
fail: function (err) {
// console.log('fail:' + JSON.stringify(err));
console.log(" Failure to pay ");
uni.showToast({
icon: 'none',
title: ' Failure to pay '
})
}
});
3、 ... and 、APP Payment code :
// Order object , Get... From the server
var orderInfo = {
"appid": res.data.orderInfo.appId, // application ID(AppID)
"partnerid": res.data.orderInfo.partnerId, // Merchant number (PartnerID)
"prepayid": res.data.orderInfo.prepayId, // Pre payment transaction session ID
"package": res.data.orderInfo.packageValue, // Fixed value
"noncestr": res.data.orderInfo.nonceStr, // Random string
"timestamp": res.data.orderInfo.timeStamp, // Time stamp ( Company : second )
"sign": res.data.orderInfo.sign, // Signature , Used here MD5 Signature
};
uni.requestPayment({
provider: "wxpay",
orderInfo: orderInfos,
success(res) {
console.log('success:' + JSON.stringify(res));
console.log(" Successful payment ");
},
fail(err) {
console.log('fail:' + JSON.stringify(err));
console.log(" Failure to pay ");
});
ending~
边栏推荐
- OSPF theory
- How to use modify run configuration on pychart with parameter configuration
- (manual) [sqli-labs50-53] order by injection
- PSIM simulation model construction of buck circuit (II) (use of transfer function module)
- [深入研究4G/5G/6G专题-38]: URLLC-9-《3GPP URLLC相关协议、规范、技术原理深度解读》-3-URLLC技术的分析思路与研究方法:深度、广度、时间
- Deadlock prevention, deadlock avoidance, deadlock detection
- JUC的基本使用
- Payment transaction snark in Mina
- 4. Connect terminated threads (recycle threads)
- Dialogue Yinqi: what we insist on will not change, and broad vision will jump out of the "cyclical law" of enterprise scientific research
猜你喜欢

Theoretical knowledge of static routing

【学浪下载教程】06学浪模拟网页版登录,无需客户端和全局代理软件

Horizon 8 test environment deployment (7): app volumes deployment

OpenGL ES学习(4)——投影和绘制

Zordle: zkp based wordle application

wallys/Qualcomm IPQ8072A networking SBC supports dual 10GbE, WiFi 6

静态路由理论知识
自动化测试框架有哪几种?搭建的思路是什么?一篇文章让你彻底了解自动化

【学浪下载教程】05学浪下载之正式抓包下载

OpenGL es learning (6) -- recognizing textures
随机推荐
OpenGL ES学习(5)——光照
单源最短路径
JUC的基本使用
Codeforces Round #805 (Div. 3)(A,B,C,D)
Taote commodity details API interface (commodity sales interface, commodity price sorting interface, repeat customers often buy interface, APP commodity details interface, commodity attribute interfac
Tree structure in Mina
Codeforces Round #806 (Div. 4)(A.B.C.D.E.F)
[深入研究4G/5G/6G专题-38]: URLLC-9-《3GPP URLLC相关协议、规范、技术原理深度解读》-3-URLLC技术的分析思路与研究方法:深度、广度、时间
Test management knowledge: how to transform from a business expert to a grass-roots Manager
【uniapp调用微信支付】uniapp开发小程序-调用微信支付
【学浪下载教程】02学浪下载之Fiddler学浪插件配置
Nc20583 [sdoi2016] gear
jupyter notebook的kernel管理
Green install MySQL version 5.7 - configure my INI file considerations
2022 年度杭州未来科技城数字经济人才编程大赛
Eventbus is used temporarily
Eight common SQL misuses in MySQL
处理数字用中文表示
Nc20566 [scoi2010] games
wallys/Qualcomm IPQ8072A networking SBC supports dual 10GbE, WiFi 6