create and item for which you are taking payment // if you need to add more items in the list // Then you will need to create multiple item objects or use some loop to instantiate object Public ActionResult PaymentWithCreditCard() Call function Create of the payment classĪdd the action PaymentWithCreditCard to this controller as below:.Get access token using the GetApiContext call.Create Payment object with all the items and billing details.Steps that are performed in the controller are listed below: You need to add a new Action named PaymentWithCreditCard. When you add a controller, there is a default Action Index created by the IDE for you. So, first of all, add a controller in the controllers namespace and give any name you like to this controller. Second, we are ready to write the C# code to make the calls to the paypal API now after adding the needed SDK libraries and adding their references in it. Then, from the settings of that account, you can get this clientID and clientSecret and enter them here under the paypal settings tag. (If you don't have a paypal developer account, then you need to register for an account first on the paypal developer website here and create a facilitator/vendor account). Get these from your developer paypal account. And then, you need to configure your paypal facilitator account details inside here i.e., clientID and clientSecret key. Notice that we have mode set to sandbox in the paypal settings. Under the tag in the web.config file, put these settings in. So, open the web.config file and add the configurations as shown below. Now, we need to setup our web.config file with the configurations to be used. It installed version 6.xx.xx on my machine. These are the assemblies which need to be referenced.īasically, the SDK uses json to communicate with the Paypal API that is why it installs the latest version of newtonsoft.json library. If the reference to the libraries are not automatically added, then you can add references to the DLLs manually by right clicking on the References in your project in Solution Explorer and Choosing Add Reference. To add the Paypal SDK libraries in your project, use this command in the console: It will open a command console in the Visual Studio. So, Goto Tools -> Library Package Manager -> Package Manager Console. This way, it is easier to add the SDK libraries to the project and is a recommended way especially for beginners. Now we need to install the PAYPAL SDK for. So, first of all, open the Visual Studio IDE (I am using Visual Studio 2012) and create an ASP.NET MVC 4 project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |