Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,62 @@ | ||
# xorpay_miniapp_demo | ||
|
||
xorpay 小程序支付 demo | ||
直接用 微信开发者工具 导入项目运行即可,记得修改自己的 aid 和 app secret | ||
- xorpay 小程序支付 demo | ||
- 先联系管理员开通你账号的跳转权限 | ||
- 直接用 微信开发者工具 导入项目运行即可,记得修改自己的 aid 和 app secret | ||
|
||
跳转 XorPay 收银台小程序 appid: wx6eeed4ca124a1abf | ||
|
||
在 app.json 中添加: | ||
|
||
``` | ||
"navigateToMiniProgramAppIdList": [ | ||
"wx6eeed4ca124a1abf" | ||
] | ||
``` | ||
|
||
小程序跳转代码: | ||
|
||
``` | ||
wx.navigateToMiniProgram({ | ||
appId: 'wx6eeed4ca124a1abf', | ||
path: 'pages/index/index', | ||
extraData: { | ||
'aid': '1', #aid | ||
'name': 'XorPay充值', | ||
'pay_type': 'jsapi', | ||
'price': '0.02', | ||
'order_id': 'm-5', | ||
'notify_url': 'https://abc.com/notify', | ||
'sign': md5.hexMD5('XorPay充值' + 'jsapi' + '0.02' + 'm-5' + 'https://abc.com/notify' + 'app secret'), | ||
}, | ||
envVersion: 'develop', | ||
fail(res) { | ||
wx.showToast({ | ||
title: res.errMsg, | ||
icon: 'none', | ||
}); | ||
}, | ||
success(res) { | ||
wx.showToast({ | ||
title: 'ok', | ||
icon: 'none', | ||
}); | ||
}, | ||
}); | ||
``` | ||
|
||
支付成功或者取消,会跳回你的小程序,并携带参数: | ||
|
||
支付成功 | ||
``` | ||
extraData: { | ||
status: 'success' | ||
} | ||
``` | ||
|
||
支付取消 | ||
``` | ||
extraData: { | ||
status: 'cancel' | ||
} | ||
``` |