.Payer E-mail address of buyer. .Receiver E-mail address of receiver.
Executing a QueryNow that you have a basic idea of the types of operations supported by the PayPal API, let s look atsome simple code examples to see how they work. PayPal API calls can be executed using SOAPopera- tions. As you recall, with SOAPoperations, you have to specify the location of the WSDLfile thatdescribes the Web API and then create a proxy so that your program knows how to communicatewiththe Web API. Visual Studio .NET handles the creation of the proxy for you when you add a Webreference. Walkthrough Example Calling the PayPal API Using SOAP from Visual Studio .NETLet s walk through a step-by-step example of using SOAPto call the PayPal Web service from VisualStudio .NET. In this example, you call the RefundTransactionoperation to fully refund a prior trans- action that you manually created earlier in this chapter. 1.Open Visual Studio .NET and select File.New.Project. 2.Select Visual Basic Project as the Project Type, and select Windows Application as the Template. For the project name, specify PayPalSample, and for the path, specify the location where youwant the project to be created. Click OK to create the new project. 3.Drag and drop one command button from the Toolbox onto the form. 4.Add a reference to the PayPal API by selecting Project.Add Web Reference. For the URLfield, specify the location of the WSDLfile, such as: www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl5.Click the GO button so that Visual Studio can locate the PayPal Web API. 6.Change the Web Reference Name to PayPalso that you can use a shorter name in your project. 7.Click the Add Reference button to add the reference to your project. Visual Studio .NET uses theWSDLfile to identify the methods that are available for execution from your project. 8.Add the following procedure to Form1to the Clickevent of the second button: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _ System.EventArgs) Handles Button1.ClickOn Error GoTo handle_error create a reference to the paypal serviceDim pp As New PayPal.PayPalAPIInterfaceService set the required credentials for using the servicepp.RequesterCredentials = New PayPal.CustomSecurityHeaderTypepp.RequesterCredentials.Credentials = New PayPal.UserIdPasswordTypepp.RequesterCredentials.Credentials.Username = Your PayPal DevZone userid pp.RequesterCredentials.Credentials.Password = Your PayPal DevZone pwd pp.RequesterCredentials.Credentials.AuthCert = my_paypal_certificate.cer pp.Url = https://api.sandbox.paypal.com/2.0/ Dim request As New PayPal.RefundTransactionReqrequest.RefundTransactionRequest = New PayPal.RefundTransactionRequestType160Chapter
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Cheap Web Hosting services