www.gusucode.com > 中网景企业网站源码时尚版 2009.73码程序 > common/Alipay_Payto.asp

    <%
Dim INTERFACE_URL
INTERFACE_URL="https://www.alipay.com/cooperate/gateway.do?"
Class creatAlipayItemURL
Public Function creatAlipayItemURL(subject,body,out_trade_no,price,quantity,seller_email)
Dim mystr,acount,i,j,minmax,minmaxSlot,mark,temp,md5str,sign,itemURL,thevalue
mystr = Array("service=trade_create_by_buyer","partner="&partner,"subject="&subject,"body="&body,"out_trade_no="&out_trade_no,"price="&price,"discount="&discount,"show_url="&show_url,"quantity="&quantity,"payment_type=1","logistics_type="&logistics_type,"logistics_fee="&logistics_fee,"logistics_payment="&logistics_payment,"seller_email="&seller_email,"notify_url="&notify_url,"return_url="&return_url)
acount=ubound(mystr)
For i = acount TO 0 Step -1
    minmax = mystr( 0 )
    minmaxSlot = 0
    For j = 1 To i
            mark = (mystr( j ) > minmax)
        If mark Then 
            minmax = mystr( j )
            minmaxSlot = j
        End If
    Next
    If minmaxSlot <> i Then 
        temp = mystr( minmaxSlot )
        mystr( minmaxSlot ) = mystr( i )
        mystr( i ) = temp
    End If
 Next

For j = 0 To acount Step 1
  thevalue = SPLIT(mystr( j ), "=")

  If  thevalue(1)<>"" then
       If j=acount Then
       md5str= md5str&mystr( j )
	   Else 
       md5str= md5str&mystr( j )&"&"
	   End If 
  End If 
  Next
       md5str=md5str&key
	   sign=md5(md5str)
	itemURL	= itemURL&INTERFACE_URL 
	For j = 0 To acount Step 1
      
	    thevalue = SPLIT(mystr( j ), "=")
		If  thevalue(1)<>"" then
		itemURL= itemURL&mystr( j )&"&"
		End If 	     
  Next
		itemURL	= itemURL&"sign="&sign&"&sign_type="&"MD5"
		creatAlipayItemURL=itemURL
	End Function
End Class
%>