Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 27th, 2007, 12:54 AM
Registered User
Join Date: Nov 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Paypal Pro Integration in Classic ASP

 I have to integrate Paypal Pro with a website developed in classic ASP. And in that I have to use API certificate and not the API signature.
  My query is how to use API certificate with NVP method. I encrypted the API certificate and installed in my PC. and the i made following changes in hash_call function in the ASP NVP samples that paypal provided.

Function hash_call ( methodName,nvpStr )
On Error Resume Next
    Set objHttp = Server.CreateObject("WinHTTP.WinHTTPRequest.5.1")
 nvpStr = Server.URLEncode("METHOD")&"=" &Server.URLEncode(methodName) &nvpStr &"&" &Server.URLEncode("VERSION")&"=" &Server.URLEncode(gv_Version) &"&" &Server.URLEncode("USER") &"=" &Server.URLEncode(gv_APIUserName)&"&PWD=" &Server.URLEncode(gv_APIPassword)

    Set SESSION("nvpReqArray")= deformatNVP(nvpStr)
    objHttp.open "POST", gv_APIEndpoint, False
    objHttp.SetClientCertificate "LOCAL_MACHINE\my\" & gv_APIUserName
    objHttp.Option(WinHttpRequestOption_SslErrorIgnore Flags) = &H3300

    If gv_UseProxy Then
    'Proxy Call
    objHttp.SetProxy gv_Proxy, gv_ProxyServer& ":" &gv_ProxyServerPort
    End If

    objHttp.Send nvpStr

    Set SESSION("nvpReqArray")= deformatNVP(nvpStr)
    Set nvpResponseCollection = deformatNVP(objHttp.responseText)
    Set hash_call = nvpResponseCollection
    Set objHttp = Nothing
    If Err.Number <> 0 Then
    SESSION("ErrorMessage") = ErrorFormatter(Err.Description,Err.Number,Err.Sour ce,"hash_call")
    SESSION("nvpReqArray") = Null
    Response.Redirect "APIError.asp"
    SESSION("ErrorMessage") = Null
    End If
End Function

Function deformatNVP ( nvpstr )
On Error Resume Next
    Dim AndSplitedArray,EqualtoSplitedArray,Index1,Index2, NextIndex
    Set NvpCollection = Server.CreateObject("Scripting.Dictionary")
    AndSplitedArray = Split(nvpstr, "&", -1, 1)

    For Index1 = 0 To UBound(AndSplitedArray)
        EqualtoSplitedArray=Split(AndSplitedArray(Index1), "=", -1, 1)
        For Index2 = 0 To UBound(EqualtoSplitedArray)
            NvpCollection.Add URLDecode(EqualtoSplitedArray(Index2)),URLDecode(E qualtoSplitedArray(NextIndex))

    Set deformatNVP = NvpCollection
    response.write("tt=" & err.number)
    If Err.Number <> 0 Then
    SESSION("ErrorMessage") = ErrorFormatter(Err.Description,Err.Number,Err.Sour ce,"deformatNVP")
' response.Write("hi" & err.number & "ss=" & err.source)
' response.End()
    Response.Redirect "APIError.asp"
    SESSION("ErrorMessage") = Null
    End If
End Function

But this is not executing. Either it gives "Security Error in hash function " or "Subscript out of range " deformatNVP function.

If any one have any sample code regarding NVP method using API certificate in classic ASP, then let me know. As I got stuck here and i m getting no way to proceed.
It's urgent to complete it.

Any help will be greatly appreciated. Thanks in advance.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
paypal and asp ocabrera70 Classic ASP Professional 3 September 25th, 2014 06:30 AM
PayPal Integration takwirira ASP.NET 2.0 Basics 0 May 12th, 2008 05:44 AM
PHP and PayPal Pro harpua Pro PHP 1 September 19th, 2005 05:35 AM
Paypal and IPN Using ASP.NET stu9820 ASP.NET 1.0 and 1.1 Basics 1 May 21st, 2005 12:52 AM
Beginning E-Commerce ASP.NET PayPal problems mluirette All Other Wrox Books 0 December 18th, 2003 03:35 PM

All times are GMT -4. The time now is 11:26 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.