uniapp-payment
Skill0 starsChanged 18 days agoMITView on GitHub
uni-app 支付流程(微信小程序支付、App 微信/支付宝支付、H5 支付)及订单状态确认。实现下单、支付、支付结果页时使用。
In this repository11 other files it gives its agents.
- pinia-storeSkill
- release-checklistSkill
- uniapp-cross-platformSkill
- uniapp-loginSkill
- uniapp-performanceSkill
- uniapp-permissionsSkill
- uniapp-project-structureSkill
- uniapp-requestSkill
- uniapp-subpackagesSkill
- uniapp-ui-libsSkill
- vue3-compositionSkill
The file
Files
支付流程
统一原则
- 前端只传 订单 ID,金额、商品由后端计算;签名全部在后端完成,商户密钥绝不放前端。
- 以服务端回调为准:前端
success只代表用户操作完成,结果页要轮询后端订单状态(如 2s 一次,最多 5 次)。 - 防重复点击:按钮 loading + 后端幂等(同一订单只发起一次预支付)。
小程序
const p = await api.createPrepay({ orderId }) // 后端返回 timeStamp/nonceStr/package/signType/paySign
try {
await uni.requestPayment({ provider: 'wxpay', ...p })
await pollOrder(orderId)
} catch (e: any) {
if (e.errMsg?.includes('cancel')) uni.showToast({ title: '已取消支付', icon: 'none' })
else uni.showToast({ title: '支付失败', icon: 'none' })
}- 小程序需已认证、开通微信支付并与商户号关联。
App
- manifest 勾选 Payment 模块;
uni.requestPayment({ provider: 'wxpay' | 'alipay', orderInfo }),orderInfo由后端生成。
H5
- 微信内:JSAPI 支付(需公众号 openid);微信外:H5 支付跳转
mweb_url,返回后在结果页查询订单。
合规
- 虚拟商品在 iOS 小程序/App 内支付受平台规则限制,提前确认;不要引导用户绕过平台支付。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

