当前位置:网站首页>小程序 支付
小程序 支付
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
边栏推荐
- 学习 Go 语言 0x04:《Go 语言之旅》中切片的练习题代码
- Gets the current time in character format
- MBA - day5 mathématiques - Questions d'application - Questions d'ingénierie
- Oracle connectivity test gadget
- Promise details
- MySQL分区表实现按月份归类
- colab
- 语雀文档编辑器将开源:始于但不止于Markdown
- How to use JDBC callablestatement The wasnull () method is called to check whether the value of the last out parameter is SQL null
- remote: Support for password authentication was removed on August 13, 2021.
猜你喜欢
随机推荐
使用 PHP PDO ODBC 示例的 Microsoft Access 数据库
VScode
Mba-day5 Mathematics - application problems - engineering problems
关于JUC三大常用辅助类
Pycharm
Difference between pregnancy box and delivery box
Detailed explanation of MySQL creation stored procedure and function
Upgrade the functions available for cpolar intranet penetration
26. 删除有序数组中的重复项
Facing the global market, platefarm today logs in to four major global platforms such as Huobi
Ueditor -- limitation of 4m size of image upload component
Full stack cross compilation x86 completion process experience sharing
Solutions to common problems in visualization (IX) background color
MySQL数据库事务transaction示例讲解教程
Let the LAN group use the remote device
Hikvision face to face summary
Visual common drawing (V) scatter diagram
Detailed introduction to paging exploration of MySQL index optimization
MBA-day5数学-应用题-工程问题
全栈交叉编译X86完成过程经验分享









