first commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>测试支付</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>商户订单号:<input type="text" id="payId"/></p>
|
||||
<p>商户订单价:<input type="number" id="price" value="0.1"/></p>
|
||||
<p>自定义参数:<input type="text" id="param" value="vone666"/></p>
|
||||
<p>支付方式:<select id="type"><option value="1">微信支付</option><option value="2">支付宝支付</option></select></p>
|
||||
<button onclick="zf()">支付</button>
|
||||
<script src="https://lib.baomitu.com/jquery/3.4.0/jquery.min.js"></script>
|
||||
<script>
|
||||
$("#payId").val(new Date().getTime());
|
||||
function zf() {
|
||||
var p = "payId="+$("#payId").val() + "&price="+$("#price").val()+"¶m="+$("#param").val()+"&type="+$("#type").val();
|
||||
window.location.href = "main.php?" + p;
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
ini_set("error_reporting","E_ALL & ~E_NOTICE");
|
||||
|
||||
$key = "7eed756ca37ca057370ea9bb208d25fa";//通讯密钥
|
||||
$host = "../createOrder";
|
||||
|
||||
$sign = md5($_GET['payId'].$_GET['param'].$_GET['type'].$_GET['price'].$key);
|
||||
$p = "payId=".$_GET['payId'].'¶m='.$_GET['param'].'&type='.$_GET['type']."&price=".$_GET['price'].'&sign='.$sign.'&isHtml=1';
|
||||
|
||||
echo "<script>window.location.href = '".$host."?".$p."'</script>";
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
ini_set("error_reporting","E_ALL & ~E_NOTICE");
|
||||
$key = "7eed756ca37ca057370ea9bb208d25fa";//通讯密钥
|
||||
$payId = $_GET['payId'];//商户订单号
|
||||
$param = $_GET['param'];//创建订单的时候传入的参数
|
||||
$type = $_GET['type'];//支付方式 :微信支付为1 支付宝支付为2
|
||||
$price = $_GET['price'];//订单金额
|
||||
$reallyPrice = $_GET['reallyPrice'];//实际支付金额
|
||||
$sign = $_GET['sign'];//校验签名,计算方式 = md5(payId + param + type + price + reallyPrice + 通讯密钥)
|
||||
//开始校验签名
|
||||
$_sign = md5($payId . $param . $type . $price . $reallyPrice . $key);
|
||||
if ($_sign != $sign) {
|
||||
echo "error_sign";//sign校验不通过
|
||||
exit();
|
||||
}
|
||||
|
||||
echo "success";
|
||||
|
||||
|
||||
//继续业务流程
|
||||
//echo "商户订单号:".$payId ."<br>自定义参数:". $param ."<br>支付方式:". $type ."<br>订单金额:". $price ."<br>实际支付金额:". $reallyPrice;
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
ini_set("error_reporting","E_ALL & ~E_NOTICE");
|
||||
$key = "7eed756ca37ca057370ea9bb208d25fa";//通讯密钥
|
||||
$payId = $_GET['payId'];//商户订单号
|
||||
$param = $_GET['param'];//创建订单的时候传入的参数
|
||||
$type = $_GET['type'];//支付方式 :微信支付为1 支付宝支付为2
|
||||
$price = $_GET['price'];//订单金额
|
||||
$reallyPrice = $_GET['reallyPrice'];//实际支付金额
|
||||
$sign = $_GET['sign'];//校验签名,计算方式 = md5(payId + param + type + price + reallyPrice + 通讯密钥)
|
||||
//开始校验签名
|
||||
$_sign = md5($payId . $param . $type . $price . $reallyPrice . $key);
|
||||
if ($_sign != $sign) {
|
||||
echo "error_sign";//sign校验不通过
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//继续业务流程
|
||||
echo "商户订单号:".$payId ."<br>自定义参数:". $param ."<br>支付方式:". $type ."<br>订单金额:". $price ."<br>实际支付金额:". $reallyPrice;
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user