1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-09-13 00:50:40 +08:00
Files
2026-08-31 07:58:23 +08:00

44 lines
951 B
Markdown
Raw Permalink 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.
# 支付 API
## 概述
支付 API 用于发起支付。
## API 列表
### uni.requestPayment
发起支付。
**详细文档**https://doc.dcloud.net.cn/uni-app-x/api/payment/payment.html#requestpayment
**参数**(微信小程序):
- `provider` (String) - 支付服务提供商(wxpay
- `timeStamp` (String) - 时间戳
- `nonceStr` (String) - 随机字符串
- `package` (String) - 统一下单接口返回的 prepay_id 参数值
- `signType` (String) - 签名算法
- `paySign` (String) - 签名
**示例**
```javascript
uni.requestPayment({
provider: 'wxpay',
timeStamp: String(Date.now()),
nonceStr: 'nonceStr',
package: 'prepay_id=xxx',
signType: 'MD5',
paySign: 'paySign',
success: (res) => {
console.log('支付成功', res)
},
fail: (err) => {
console.error('支付失败', err)
}
})
```
## 参考资源
- [uni-app 支付文档](https://doc.dcloud.net.cn/uni-app-x/api/payment/payment.html)