forked from yonghumeijj/sopay
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.html
More file actions
52 lines (52 loc) · 1.84 KB
/
demo.html
File metadata and controls
52 lines (52 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!--
* @Author: will
* @LastEditors: will
* @Description:
-->
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<script type="text/javascript">
document.write('<script type="text/javascript" src="https://apiupload.oss-cn-beijing.aliyuncs.com/assets/sopay.js?v=' + Math.random() + '"><\/script>')
</script>
<script>
$(document).ready(function () {
SoPay.post({
app_id: '你在我们平台的appid', //你的appid
type: 'usdtAndTrx', //支付方式或者all/usdtAndTrx/usdt/trx/wechat/alipay/qq/bankCard/alipay
uid: '23', //你网站用户id
total_fee: 2.0, //支付金额
out_trade_no: '202010092206552336', //订单号
timestamp: '1602297564', //时间戳
style: 'cloud', //云端样式
currency: 'CNY', //支付的金额是CNY 人民币或者USD 美元
language: 'zh', //语言/en
return_url: 'http://www.baidu.com', //支付完跳转
notify_url: 'http://www.baidu.com', //回调地址
param: '', //其他参数
sign: '2020091051481001', //签名
callback: function (res) {
console.log(res)
//获取二维码后显示的函数
if (res.code != 1) {
swal('错误', res.msg, 'error')
return
}
$('#base64img').attr('src', res.data.pay_url) //收款二维码
$('.total_fee').html(res.data.really_total_fee) //支付金额
$('.exprie_time').html(res.data.exp_time) //过期时间
$('.order_no').html(res.data.out_trade_no) //订单号
},
success: function (data) {
//支付成功后的函数
console.log(data)
alert('支付成功')
//跳转
},
})
})
</script>
</body>
</html>