当前位置:网站首页>小程序 支付
小程序 支付
2022-04-23 11:07:00 【被楓吹过的晨】
支付
uni.requestPayment 是一个统一各平台的客户端支付API,不管是在某家小程序还是在App中,客户端均使用本API调用支付。本API运行在各端时,会自动转换为各端的原生支付调用API。
uni.requestPayment( object ) 参数说明
provider 必填,为 String,服务提供商,通过 uni.getProvider 获取
orderInfo 必填,为 String 或 Object,订单数据
timeStamp 微信小程序必填,为 String,当前的时间戳
nonceStr 微信小程序必填,为 String,随机字符串,长度为32个字符以下
package 微信小程序必填,为 String,统一下单接口返回的 prepay_id 参数值
signType 微信小程序必填,为 String,签名算法,应与后台下单时的值一致
paySign 微信小程序必填,为 String,签名
bannedChannels 非必填,为 Array<String>,需要隐藏的支付方式
success 非必填,为 Function,接口调用成功的回调
fail 非必填,为 Function,接口调用失败的回调
complete 非必填,为 Function,接口调用结束的回调函数(调用成功、失败都会执行)
App 平台支付流程
支付平台功能申请 =》 manifest.json
里配置支付参数 =》 uni-app
里调用 API 进行支付
App支付
uni.requestPayment({
provider: 'alipay',
orderInfo: 'orderInfo', //微信、支付宝订单数据 【注意微信的订单信息,键值应该全部是小写,不能采用驼峰命名】
success: function (res) {
console.log('success:' + JSON.stringify(res));
},
fail: function (err) {
console.log('fail:' + JSON.stringify(err));
}
})
微信小程序支付
uni.requestPayment({
provider: 'wxpay',
timeStamp: String(Date.now()),
nonceStr: 'A1B2C3D4E5',
package: 'prepay_id=wx20180101abcdefg',
signType: 'MD5',
paySign: '',
success: function (res) {
console.log('success:' + JSON.stringify(res));
},
fail: function (err) {
console.log('fail:' + JSON.stringify(err));
}
})
版权声明
本文为[被楓吹过的晨]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_66430291/article/details/124355845
边栏推荐
- Mysql中一千万条数据怎么快速查询
- 面向全球市场,PlatoFarm今日登录HUOBI等全球四大平台
- Excel · VBA array bubble sorting function
- Visualization Road (11) detailed explanation of Matplotlib color
- Learning website materials
- Mysql系列SQL查询语句书写顺序及执行顺序详解
- Visual common drawing (I) stacking diagram
- Manjaro installation and configuration (vscode, wechat, beautification, input method)
- Detailed explanation of integer data type tinyint in MySQL
- Latex usage
猜你喜欢
ConstraintLayout布局
More reliable model art than deep learning
Intuitive understanding entropy
Visualization Road (11) detailed explanation of Matplotlib color
MySQL Router重装后重新连接集群进行引导出现的——此主机中之前已配置过的问题
CUMCM 2021-b: preparation of C4 olefins by ethanol coupling (2)
Jupyter lab top ten high productivity plug-ins
C语言之结构体(进阶篇)
语雀文档编辑器将开源:始于但不止于Markdown
Manjaro installation and configuration (vscode, wechat, beautification, input method)
随机推荐
解决 『SunCertPathBuilderException:unable to find valid certification path to requested target』 问题
MIT:用无监督为世界上每个像素都打上标签!人类:再也不用为1小时视频花800个小时了
Resolution and size of mainstream mobile phones
第六站神京门户-------手机号码的转换
MySQL索引优化之分页探索详细介绍
Full stack cross compilation x86 completion process experience sharing
全栈交叉编译X86完成过程经验分享
Chapter 1 of technical Xiaobai (express yourself)
MySQL分区表实现按月份归类
Google Earth engine (GEE) - scale up the original image (taking Hainan as an example)
Prevent SQL injection in web projects
Esp32 learning - use and configuration of GPIO
MBA-day5数学-应用题-工程问题
Solutions to common problems in visualization (IX) background color
Understand the key points of complement
Cumcm 2021 - B: préparation d'oléfines C4 par couplage éthanol (2)
Detailed explanation of MySQL creation stored procedure and function
Oracle connectivity test gadget
VIM usage
MySQL8.0升级的踩坑历险记