Paypal Integration

I need some help with integrating Paypal’s PDT to be used with my Domino Server. I ma able to get the post from the paypal server, but am unable to post a HTTP Post response back to paypal to get the final response back with the transaction data. Any help and examples would be great. Thanks in advance for any help you can give me.

Subject: Paypal Integration

Hi Brett

If you goto paypal you can find help file (pdf format).

I hope that help file help you.

thanks

Subject: RE: Paypal Integration

All of their information is for every other type of server, but nothing for Domino, I am not very familiar with coding outside of Domino. So the information is not very helpful, and I talked to the paypal people and they were not able to help either. Thanks

Subject: RE: Paypal Integration

I did 2 Years back but i could’t remember what i did.

i will let you later.

thanks

cts_janardan@yahoo.com

Subject: Paypal Integration - Solved

I was not able to use the PDT version of paypal, however I did get the IPN to work with the following process.

Under the profile tab on the paypal system turn on IPN and point the url to an agent you will create in your database.

http://your_server/your_database/your_agentname?openagent

Here is the lotus script i used in the agent to develop the HTTP Post, it will post the data back to Paypal and then accept the response from Paypal whether the payment is invalid or verified. You can then post the data to a form named in the agent. I create a form with computed fields to gather the payment details for our records.

Sub Initialize

%REM

This routine will create a new HTTP POST request, send values, and retrieve the response from the server. This is done via the XMLHTTP object of the MSXML parser.

%END REM

Dim s As New NotesSession

Dim doc As NotesDocument

Dim objHttp As Variant

Dim response As String

Dim request As String

Dim reqString As String

Dim postString As String

Dim NameValuePairs As Variant





On Error Goto ErrHandler



Set db = s.CurrentDatabase

Set doc = s.DocumentContext



reqString = doc.Request_Content(0)

postString = reqString & "&cmd=_notify-validate"



NameValuePairs = Split(doc.Request_Content(0),"&")



Forall nv In NameValuePairs

	Call doc.ReplaceItemValue(Strleft(nv,"="),Strright(nv,"="))

End Forall

’ — instantiate an MSXML XMLHTTP object

Set objHttp = CreateObject("WinHTTP.WinHTTPRequest.5.1")



objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", False

objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"



objHttp.send(postString )



If (objHttp.status <> 200 ) Then

	

Elseif (objHttp.responseText = "VERIFIED") Then

’ check that Payment_status=Completed

’ check that Txn_id has not been previously processed

’ check that Receiver_email is your Primary PayPal email

’ check that Payment_amount/Payment_currency are correct

’ process payment

Elseif (objHttp.responseText = "INVALID") Then

’ log for manual investigation

Else

’ Probably a 200 error occurred! Check if payment is done, manually!

End If



doc.Status = objHttp.responseText 

'include the name of the form you want the data to post to, include a query string field to gather the data.

doc.Form = "Your_Form_Name"

Call doc.Save(True, True)

Cleanup:

Set objHttp=Nothing

Exit Sub

ErrHandler:

’ — runtime error occurred

Messagebox(Error$ & " in line " & Cstr(Erl)) 

Resume Cleanup

End Sub

I want to thank the person who created the code, if I could remember where I got it I would give them the credit. I search for weeks trying to find such a script, so I hope it helps others.

Subject: Paypal Integration - Solved - One more question

First off, thanks very much for the code. Unfortunately, I am getting an INVALID response from Paypal. My postback string is as follows:

mc_gross=126.00&address_status=confirmed&item_number1=&tax=0.00&item_number2=&payer_id=4AZTM22YN698S&item_number3=&address_street=338+aasdf+asdf+Lane&payment_date=15%3A43%3A08+Feb+24%2C+2007+PST&payment_status=Pending&charset=windows-1252&address_zip=07031&mc_shipping=0.00&mc_handling=0.00&first_name=Joseph&address_country_code=US&address_name=Joseph+Dellanno&notify_version=2.1&custom=&payer_status=unverified&address_country=United+States&num_cart_items=3&mc_handling1=0.00&mc_handling2=0.00&mc_handling3=0.00&address_city=North+Tester&verify_sign=AJHNyQ8nmsVVM.hW01fHQX5vCko1APECX74ADAzfjdrx8WZOfDX29RsQ&payer_email=jdell000TEST2%40yahoo.com&mc_shipping1=0.00&mc_shipping2=0.00&mc_shipping3=0.00&txn_id=0&payment_type=instant&last_name=Dellanno&address_state=NJ&item_name1=ffff+%284D97730E4D9860128725724A00809A33%29±+Espanol&receiver_email=zsb123%40gmail.com&item_name2=ggggggggggggggg+%281F9E4B25D57436B28725724A0081FAF2%29±+Espanol&item_name3=hhhhhhhhhhhhhhh+%28B4DCC143F8E8DEE18725724A00821CCB%29±+Deutsch&quantity1=1&quantity2=1&pending_reason=unilateral&quantity3=1&txn_type=cart&mc_gross_1=5.00&mc_currency=USD&mc_gross_2=55.00&mc_gross_3=66.00&residence_country=US&test_ipn=1&payment_gross=126.00&cmd=_notify-validate

which is being autogenerated by the script. I tried using:

'Set objHttp = CreateObject(“WinHTTP.WinHTTPRequest.5.1”) 'Orig from the script in this thread

and

Set objHttp = CreateObject(“Msxml2.ServerXMLHTTP”) 'code from Paypal Code snippet (For VBScript)

Has anyone experienced the same issue? If so, any suggestions would be helpful.