我已经安装了paypal api证书,并使用winhttpcertcfg为私钥提供了正确的身份。我已经用尽了各种论坛上发现的所有“已知修复”并继续得到此错误。我正在运行最新的msxml版本。
使用paypal代码示例我收到错误
msxml3.dll错误'80072f0c' 完成客户端身份验证需要证书
使用3.0,4.0或6.0版本的MSXML2.ServerXMLHTTP时,错误是不变的,并且在尝试使用REST Api时收到相同的错误。
我正在测试连接的代码如下。
<%
Dim vrequest, strPayPalCert
Dim payPalURL, payPalUser, payPalAppID, payPalPassword, payPalClientID, payPalSecret
Const SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056
Const SXH_OPTION_SELECT_CLIENT_SSL_CERT = 3
payPalURL = "https://api.sandbox.paypal.com"
payPalUser = "xx_user_xx"
payPalAppID = "APP-80W284485P519543T"
payPalPassword = "xx_password_xx"
payPalClientID = "xx_client_id_xx"
payPalSecret = "xx_secret_xx"
Const paypal_request_format = "JSON"
Const paypal_response_format = "JSON"
strPayPalCert = "paypal_cert_name"
vrequest = vrequest & "&actionType=" & "PAY"
vrequest = vrequest & "&cancelUrl= cancelUrl.asp"
vrequest = vrequest & "&clientDetails.ipAddress=" & Request.ServerVariables("LOCAL_ADDR")
vrequest = vrequest & "&clientDetails.partnerName=MySite"
vrequest = vrequest & "¤cyCode=USD"
vrequest = vrequest & "&feesPayer=0.00"
vrequest = vrequest & "&receiverList.receiver(0).email=receiver@paypal.com"
vrequest = vrequest & "&receiverList.receiver(0).amount=1.00"
vrequest = vrequest & "&requestEnvelope.errorLanguage=" & "en_US"
vrequest = vrequest & "&requestEnvelope.detailLevel=" & "ReturnAll"
vrequest = vrequest & "&returnUrl=returnURL.asp"
If not isobject(vXMLHttp) Then
Set vXMLHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
End If
vXMLHttp.setOption(2) = SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
' This throws certificate error due to space
vXMLHttp.setOption(3) = "LOCAL_MACHINE\My\ " & strPayPalCert
'This works
vXMLHttp.setOption(3) = "LOCAL_MACHINE\My\" & strPayPalCert
strURL = "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay"
vXMLHttp.open "POST", strURL, false
vXMLHttp.setRequestHeader "X-PAYPAL-SECURITY-USERID", payPalUser
vXMLHttp.setRequestHeader "X-PAYPAL-SECURITY-PASSWORD", payPalPassword
vXMLHttp.setRequestHeader "X-PAYPAL-REQUEST-DATA-FORMAT", paypal_request_format
vXMLHttp.setRequestHeader "X-PAYPAL-RESPONSE-DATA-FORMAT", paypal_response_format
vXMLHttp.setRequestHeader "X-PAYPAL-APPLICATION-ID", payPalAppID
vXMLHttp.Send vrequest
vXMLHttp.waitForResponse 5
strResponse = vXMLHttp.responseText
Set RegularExpressionObject = nothing
Set vXMLHttp = nothing
arrList = split(strResponse, chr(38))
For each item in arrList
Response.Write(item & "<br />" )
Next
strTemp = arrList(4)
arrList = split(strTemp, chr(61))
Response.Write("<br><br>Now you need to redirect user to paypal server to complete transaction using following URL:<br>")
Response.Write("https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=" &arrList(1))
%>
编辑显示解决方案
答案 0 :(得分:0)
证书身份验证在Classic ASP中不起作用。尝试使用外部库(如cURL)来执行HTTPS请求。