A Simple Web Form (ASP.NET) Application for Capturing Credit Card Payment using PayPal Pro Direct Payment API

Emran Hussain,
Dec 1, 2013

If you have a PayPal Pro account and planning to integrate Direct Credit Card Payment Capturing solution into your web application, then, this article will help. I have demonstrated how to use the PayPal-provided library for creating a very basic Form for capturing Credit Card Payments. In this sample application, our intention is to present our customer a simple form like this:


To follow this article, please download the sample application I have attached here. Once you open the application in Visual Studio, you will find the following file structure:


So, there are 2 Projects. One is named PayPalProSOAPAPI class library project, and the other is Web Application project named WebApplication1. So, the PayPalProSOAPAPI class library project is the reusable project that you can just place within your real ASP.NET Web Solution. The WebApplication1 project is a Web Form project, but you can simply use the idea in ASP.NET MVC application too.

Ok, now, please note that the PayPalProSOAPAPI project consists of many class files for various API offered by PayPal, but in our WebApplication1 demonstration, we will simply use the DoDirectPayment API which is required for capturing credit card payment. For the front end, we created a Web Form page Default.aspx like this :


In the back end, the main logic for calling the DoDirectPayment API is tied to the Click Event handler of the 'Pay Now' button.


So, we have just prepared the fully working prototype for you. All you need to do is change the variables and integrate into your web solution. By the way, you do need to set your PayPal API Credentials in a class so that PayPal will know which account to use for depositing the money. Please open the ConfigData.cs file from the PayPalProSOAPAPI class library project as shown below:


Once you got PayPal Pro Account, you should have your Merchant Session ID, API User Name, API Password and API Signature. How to get the API Credentials? Ok, I found the following article shows easy step by step procedure to get you the required credentials: http://gpsdurai.wordpress.com/2011/01/06/easy-steps-to-get-paypal-api-credentials/

As the attached solution is a full working prototype, I hope, there is nothing much to say about it. Good luck with your 'PayPal Pro' Integration.

Last Modified at Sep 12, 2018
© All content, photographs, graphs and images in this article are copyright protected by SpiceLogic Inc. and may not, without prior written authorization, in whole or in part, be copied, altered, reproduced or published without exclusive permission of its owner. Unauthorized use is prohibited.

Please feel free to share your comment.