欢迎来到元素模板ys720.com,本站提供专业的织梦模板PBOOTCMS模板网站模板网站修改/网站仿站
当前位置:主页 > 程序教程 > 其他教程 >
其他教程

微信H5商家存在未配置的参数,请联系商家解决其他解决方法

(元素模板) / 2023-03-17 21:08

最近遇见了很多的朋友在做H5微信支付的,出现一个错误【商家存在未配置的参数,请联系商家解决】。

今天在这里给大家详细的分析一下:

1.先添加项目使用的域名-请登陆商户号对应的商户平台--"产品中心"--"开发配置"自行配置 

2.查看http请求头中的Referer 是否跟你配置的支付域名一致,如果不一致就添加referer的域名到H5支付域名中

3.还有种情况就是需要伪造referer:
 

ASP:

dim http
set http=server.createobject("MSXML2.XMLHTTP") '//MSXML2.serverXMLHTTP也可以
Http.open "GET",url,false
Http.setRequestHeader "Referer","http://www.05809.cn/"
Http.send()

PHP(前提是装了curl):

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "http://www.ys720.com/xxx.asp");
curl_setopt ($ch, CURLOPT_REFERER, "http://www.ys720.com/");
curl_exec ($ch);
curl_close ($ch);

PHP(不装curl用sock)
$server = 'www.ys720.com';
$host = 'www.ys720.com';
$target = '/xxx.asp';
$referer = 'http://www.ys720.com/'; // Referer
$port = 80;
$fp = fsockopen($server, $port, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br />\n";
}
else
{
$out = "GET $target HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "Cookie: ASPSESSIONIDSQTBQSDA=DFCAPKLBBFICDAFMHNKIGKEG\r\n";
$out .= "Referer: $referer\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp))
{
echo fgets($fp, 128);
}
fclose($fp);
}


VB.NET/C#.NET

Dim oXMLHttp As MSXML2.XMLHTTP30 = New MSXML2.XMLHTTP30()
或者
MSXML2.XMLHTTP30 oXMLHttp = new MSXML2.XMLHTTP30();
oXMLHttp.open(....
oXMLHttp.setRequestHeader(...
oXMLHttp.send(..


//js
var url = "http://www.yourtarget.com";
var param = "name=david&age=30";
var obj = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
obj.Open("POST", url, false);
obj.Option(4) = 13056;
obj.Option(6) = false; //false可以不自动跳转,截取服务端返回的302状态。
obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
obj.setRequestHeader("Referer", "http://www.baidu.com");
obj.Send(param);
WScript.Echo(obj.responseText);

//app
app 解决if (("4.4.3".equals(android.os.Build.VERSION.RELEASE))
|| ("4.4.4".equals(android.os.Build.VERSION.RELEASE))) {
//兼容这两个版本设置referer无效的问题
view.loadDataWithBaseURL("商户申请H5时提交的授权域名",
"<script>window.location.href=\"" + targetUrl + "\";</script>",
"textml", "utf-8", null);
} else {
Map<String, String> extraHeaders = new HashMap<>();
extraHeaders.put("Referer", "商户申请H5时提交的授权域名");
view.loadUrl(targetUrl, extraHeaders);
}

//java
/**
* 用httpClient 模拟修改referer属性,仅供用于WEB安全防范示例。
*
* @author auth
*/
public class EasyModifyHeader {
public static void main(String[] args) throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
String url = "http://www.wuranyubao.cn/wryb_rdcity.php";
HttpPost httpPost = new HttpPost(url);
//设置防外链头信息
httpPost.setHeader("origin", "http://www.wuranyubao.cn");
httpPost.setHeader("referer", "http://www.wuranyubao.cn/wryb_prev.php?movie=no");
//建立HttpPost对象
List<NameValuePair> params=new ArrayList<NameValuePair>();
//建立一个NameValuePair数组,用于存储欲传送的参数
params.add(new BasicNameValuePair("rdcity","Shandong,Jinan,20151121"));
httpPost.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
CloseableHttpResponse response = httpclient.execute(httpPost);
try {
HttpEntity entity = response.getEntity();
//打印目标网站输出内容
System.out.println(EntityUtils.toString(entity));
EntityUtils.consume(entity);
} finally {
response.close();
}
} finally {
httpclient.close();
}
}
}

Copyright @ 2013-2021 元素模板 www.ys720.com All Rights Reserved. 版权所有 元素模板 www.ys720.com