|
|
|
Rank: Starting Member
Groups: Registered
Joined: 3/7/2011 Posts: 1
|
I have a C# web server that im trying to integrate paypal's IPN into. I have viewed the asp.net examples hoping that it would help with C#. Unfortunately C# doesnt have the "Request" object built into it, and when i use the system.web dll it comes back as a null reference exception. Does anyone happen to have a example using C# outside of asp.net's C#?
|
|
|
|
|
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 6/9/2011 Posts: 3 Location: Minneapolis
|
This is the VB.NET conversion for getting transaction detail. Ensure you add the following 'Imports' or 'Using' statements to reference the dll's
I added the serializaion code in the last part of the function to convert the native class to simple XML output.
You can test with the following transaction that appears in the database for the sandbox: 0DG1296821648494L
Imports System.Web.Services.WebService Imports System.Xml.Serialization
Imports com.paypal.sdk.services Imports com.paypal.soap.api Imports com.paypal.sdk.profiles
Function GetTransactionDetailsCode(ByVal trxID As String) As String
Dim caller As New CallerServices()
Dim profile As IAPIProfile = ProfileFactory.createSignatureAPIProfile()
' Set up your API credentials, PayPal end point, and API version. profile.APIUsername = "sdk-three_api1.sdk.com" profile.APIPassword = "QFZCWN5HZM8VBG7Q" profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ" profile.Environment = "sandbox" caller.APIProfile = profile
' Create the request object. Dim concreteRequest As New GetTransactionDetailsRequestType() concreteRequest.Version = "51.0"
' Add request-specific fields to the request. concreteRequest.TransactionID = trxID
' Execute the API operation and obtain the response. Dim pp_response As New GetTransactionDetailsResponseType() pp_response = DirectCast(caller.[Call]("GetTransactionDetails", concreteRequest), GetTransactionDetailsResponseType)
'Return pp_response.Ack.ToString()
Dim SerializedContent As New StringWriter
Try Dim x As New System.Xml.Serialization.XmlSerializer(pp_response.[GetType]())
'x.Serialize(Console.Out, WSResults) x.Serialize(SerializedContent, pp_response) Console.WriteLine(SerializedContent.ToString)
Catch ex As Exception
End Try
Return True
End Function
Good luck.
Scott
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 7/26/2011 Posts: 1 Location: 1905 Willow Ave, Weehawken
|
I am learning a C# language recently. I am facing problem with uploading and image. Can anybody help me with this problem?
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 3/21/2012 Posts: 5 Location: Pleasanton
|
Below site have many examples for you. Visit: http://www.functionx.com/aspnet/Lesson09.htm
|
|
|
|
Guest
|
YAFVision Theme by Jaben Cargman (Tiny Gecko)Powered by YAF |
YAF © 2003-2009, Yet Another Forum.NETThis page was generated in 0.296 seconds.