C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Paypal website payment pro in c#


Posted Date: 02 Aug 2008    Resource Type: Code Snippets    Category: C# Syntax
Author: Nitin Kumar SharmaMember Level: Silver    
Rating: Points: 6



This code sample will help you to integrate the "Website payment pro" - direct payment API using c# .net . The code given below is self explanatory.

Here is the code in c# :-


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using com.paypal.sdk.profiles;
using com.paypal.sdk.services;
using com.paypal.sdk.services;
using log4net;
public partial class PaypalPayment : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{
CallerServices caller = new CallerServices();
IAPIProfile profile = ProfileFactory.CreateAPIProfile();
profile.APIUsername ="nitin._1214308341_biz_api1.gmail.com";// "sdk-seller_api1.sdk.com";
profile.APIPassword ="1214308348";// "12345678";
profile.Environment ="sandbox";
profile.Subject ="";
profile.APISignature ="A5GwH2U8prt9wuPnGmlizZVpeMthAn39AxoXc.I0NyrkrNlL8dUfnjII";
caller.APIProfile = profile;
com.paypal.soap.api.DoDirectPaymentRequestDetailsType directPaymentDetails = new com.paypal.soap.api.DoDirectPaymentRequestDetailsType();

//Set Credit Card
com.paypal.soap.api.CreditCardDetailsType cc = new com.paypal.soap.api.CreditCardDetailsType();
cc.CreditCardType = com.paypal.soap.api.CreditCardTypeType.Visa;
cc.CreditCardNumber ="4111111111111111";
cc.ExpMonth=10;
cc.ExpYear = 2009;
cc.CVV2 ="123";
//Set Credit Card.CardOwner
com.paypal.soap.api.PayerInfoType theCardOwner = new com.paypal.soap.api.PayerInfoType();
com.paypal.soap.api.PersonNameType thePayerName = new com.paypal.soap.api.PersonNameType();
thePayerName.FirstName ="John";
thePayerName.LastName ="Doe";
theCardOwner.PayerName = thePayerName;
com.paypal.soap.api.AddressType theAddress = new com.paypal.soap.api.AddressType();
theAddress.Street1 ="123 Main";
theAddress.Street2 ="Apt 23";
theAddress.CityName ="Hill Side";
theAddress.StateOrProvince ="FL";
theAddress.PostalCode ="32550";
theAddress.Country = com.paypal.soap.api.CountryCodeType.US;
theCardOwner.Address = theAddress;
cc.CardOwner = theCardOwner;
directPaymentDetails.CreditCard = cc;
//Set Order Total
com.paypal.soap.api.BasicAmountType temp = new com.paypal.soap.api.BasicAmountType();
com.paypal.soap.api.PaymentDetailsType payDetailType = new com.paypal.soap.api.PaymentDetailsType();
temp.Value ="118.25";
temp.currencyID = com.paypal.soap.api.CurrencyCodeType.USD;payDetailType.OrderTotal = temp;
directPaymentDetails.PaymentDetails = payDetailType;
//Set IP
directPaymentDetails.IPAddress ="192.168.200.195";
//Set Transaction Type
directPaymentDetails.PaymentAction = com.paypal.soap.api.PaymentActionCodeType.Sale;

//Set Request
com.paypal.soap.api.DoDirectPaymentRequestType request = new com.paypal.soap.api.DoDirectPaymentRequestType();

//Set Payment Detail
request.DoDirectPaymentRequestDetails = directPaymentDetails;

request.DoDirectPaymentRequestDetails.CreditCard.CardOwner.Address.CountrySpecified =true;
com.paypal.soap.api.DoDirectPaymentResponseType response = (com.paypal.soap.api.DoDirectPaymentResponseType)caller.Call("DoDirectPayment"
, request);
Response.Write("response=" + response.Ack);
Response.Write(
"
response=" + response.Errors[0].LongMessage.ToString() + " - " + response.Errors[0].ErrorCode.ToString());




For more details, visit http://kaniks.blog.co.in/tag/direct-paument-api-of-paypal/




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Website payment pro  .  Website payment pro in C#  .  Source code of paypal payment pro api  .  Paypal website payment pro in C#  .  Paypal website payment pro  .  Direct payment api of paypal  .  C# code for paypal payment pro api  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Get Contact information from outlook using C#
Previous Resource: How to dynamically change meta tags when using MasterPage in ASP.NET and C#
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use