我遇到了同样的问题,但在实际示例中,代码没有变量:strPayPalCert
实际变量为:CERT_PATH
之前:vXMLHttp.setOption(3) = "LOCAL_MACHINE\My\" & strPayPalCert
现在:vXMLHttp.setOption(3) = CERT_PATH
这是完整的代码:
<!-- #include file ="../Constants.asp" -->
<%
'###################################################################
'THIS IS STRICTLY EXAMPLE SOURCE CODE. IT IS ONLY MEANT TO
'QUICKLY DEMONSTRATE THE CONCEPT AND THE USAGE OF THE ADAPTIVE
'PAYMENTS API. PLEASE NOTE THAT THIS IS *NOT* PRODUCTION-QUALITY
'CODE AND SHOULD NOT BE USED AS SUCH.
'
'THIS EXAMPLE CODE IS PROVIDED TO YOU ONLY ON AN "AS IS"
'BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
'EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES
'OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
'FITNESS FOR A PARTICULAR PURPOSE. PAYPAL MAKES NO WARRANTY THAT
'THE SOFTWARE OR DOCUMENTATION WILL BE ERROR-FREE. IN NO EVENT
'SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
'DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
'CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
'OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
'OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
'LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
'(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
'THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
'OF SUCH DAMAGE.
'###################################################################
'----------------------------------------------------------------------
'This file does data processing. Gets values from HTML form
'and sends request to PayPal Adaptive API
'----------------------------------------------------------------------
'----------------------------------------------------------------------
'Lets check was POST submitted in HTML form and only proceed if it was
'----------------------------------------------------------------------
if Request.Form("submit") = "" then
Response.Redirect "../index.asp"
end if
'----------------------------------------------------------------------
'POST was submitted so proceed with data processing
'----------------------------------------------------------------------
'----------------------------------------------------------------------
'Build up NVP strings. Some of these values are hardcoded
'and some are taken from Request.Form array. Please edit these fields
'to suit your testing scenario
'----------------------------------------------------------------------
Dim vrequest
vrequest = vrequest & "&actionType=" & "PAY"
vrequest = vrequest & "&cancelUrl=" & Request.Form("cancelUrl")
vrequest = vrequest & "&clientDetails.ipAddress=" & Request.Form("ipAddress")
vrequest = vrequest & "&clientDetails.partnerName=" & Request.Form("partnerName")
vrequest = vrequest & "¤cyCode=" & Request.Form("currencyCode")
vrequest = vrequest & "&feesPayer=" & Request.Form("feesPayer")
vrequest = vrequest & "&receiverList.receiver(0).email=" & Request.Form("email")
vrequest = vrequest & "&receiverList.receiver(0).amount=" & Request.Form("amount")
vrequest = vrequest & "&requestEnvelope.errorLanguage=" & "en_US"
vrequest = vrequest & "&requestEnvelope.detailLevel=" & "ReturnAll"
vrequest = vrequest & "&returnUrl=" & Request.Form("returnUrl")
'----------------------------------------------------------------------
'Create HTTP object and do comunication with API's
'----------------------------------------------------------------------
If not isobject(vXMLHttp) Then
Set vXMLHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
End If
'----------------------------------------------------------------------
'Map you certificate to just created HTTP object
'----------------------------------------------------------------------
vXMLHttp.setOption(3) = CERT_PATH
'----------------------------------------------------------------------
'Set AP / AA target url and open the connection
'----------------------------------------------------------------------
strURL = "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay"
vXMLHttp.open "POST", strURL, false
'----------------------------------------------------------------------
'Set HTTP headers. Using constants from Constants.asp
'----------------------------------------------------------------------
vXMLHttp.setRequestHeader "X-PAYPAL-SECURITY-USERID", API_USERNAME
vXMLHttp.setRequestHeader "X-PAYPAL-SECURITY-PASSWORD", API_PASSWORD
vXMLHttp.setRequestHeader "X-PAYPAL-REQUEST-DATA-FORMAT", REQUEST_FORMAT
vXMLHttp.setRequestHeader "X-PAYPAL-RESPONSE-DATA-FORMAT", RESPONSE_FORMAT
vXMLHttp.setRequestHeader "X-PAYPAL-APPLICATION-ID", APPLICATION_ID
'----------------------------------------------------------------------
'Send the request and wait for 5 seconds for response
'----------------------------------------------------------------------
vXMLHttp.Send vrequest
vXMLHttp.waitForResponse 5
'----------------------------------------------------------------------
'Work with response from PayPal
'----------------------------------------------------------------------
strResponse = vXMLHttp.responseText
'----------------------------------------------------------------------
'Manage our objects / release them
'----------------------------------------------------------------------
Set RegularExpressionObject = nothing
Set vXMLHttp = nothing
'----------------------------------------------------------------------
'Print out received response
'----------------------------------------------------------------------
Response.Write("Results received from PayPal<br>")
Response.Write("################################################################<br>")
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))
%>
<br><br>
<a href="../index.asp" title="Back to main">Back to Main page</a>
这个问题的解决方案是什么?