
<%response.End()
	Function parseURL(params)
		dim xmlContent
		xmlContent = ""
		keys	= params.Keys()
		For Each k In keys
			xmlContent=xmlContent & k &"=" & params(k) & "&"
		Next
        parseURL= xmlContent
	End Function
	Function getSign(signParams)
		Dim keys,k,v,i,j,md5str,sign
		keys	= signParams.Keys()
		'°´×ÖÄ¸Ë³ÐòÅÅÐò
		for i=0 to UBound(keys)-1
			for j=i+1 to UBound(keys)
				if StrComp(keys(i), keys(j)) > 0 then 
					tmp=keys(i)
					keys(i)=keys(j)
					keys(j)=tmp
				end if
			next
		next
		'×éºÏÇ©Ãû×Ö·û´®
		For Each k in keys
			v = signParams(k)
			if v <> "" and k <> "sign" and k <> "key" then
				md5str	= md5str & k & "=" & v & "&"
			end if
		Next
		'Ìí¼Ókey×Ö¶Î
		md5str			= md5str & "key=" & skey
		sign			= UCase(md5(md5str))
		getSign	= sign
	End Function
	function checkSign(signParams,sing)
		hqsign = getSign(signParams)
		if hqsign=sing then
			checkSign=true
		else
			checkSign=false
		end if
	end function
	
randarr="ik000000007"
feeq=100
notifyUrl="http://r.ik.ikpay.net/pay/weixin/notify_url.asp"
appid=" "
mchid=" "
skey=" "
act="buy"
paytoUrl="http://ikpay.cn/pay/weixin/index.php"
'paytoUrl="http://www.qynice.com/onlinepay/pay/weixin/index.php"

			Set d =Server.CreateObject("Scripting.Dictionary")
			d.Add "body_title","¶©µ¥:"&randarr
			d.Add "out_trade_no",randarr
			d.Add "total_fee",feeq
			d.Add "notify_url",notifyUrl
			d.Add "trade_type","NATIVE"
			d.Add "appid", appid
			d.Add "mch_id", mchid
			d.Add "paykey", skey
			d.Add "attach", act
			Dim result
			result=parseURL(d)
			Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
			xmlhttp.Open "POST", paytoUrl, false
			xmlhttp.SetRequestHeader "content-type", "application/x-www-form-urlencoded"
			xmlhttp.Send result		
			response.Write xmlhttp.responseTEXT

%>