you can use .NET SDK for Payflow Pro classes, your application sends a transaction request to a Payflow Pro host, where Payflow Pro server processes the request and then sends back a transaction response to your application to notify you of the transaction status. In the request and response cycle, a credit card transaction is accomplished and funds are moved in or out of your bank account that is linked to your Payflow Pro payment gateway account.
For testing : pilot-payflowpro.paypal.com For production: payflowpro.paypal.com
Transaction RequestTRXTYPE=S&TENDER=C&ACCT=5105105105105100&EXPDATE=1209&CVV2=123&AMT=99.00
&FIRSTNAME=John&LASTNAME=Smith&STREET=123 Main St.&CITY=SanHose
&STATE=CA&ZIP=12345&COMMENT1=Reservation&USER=MyUser&PWD=MyPassword
&VENDOR=MyVendor&PARTNER=MyPartner
Transaction Response
RESULT=0&PNREF=EFHP0D426A53&RESPMSG=APPROVED&AUTHCODE=25TEST&
AVSADDR=Y&AVSZIP=N&CVV2MATCH=Y
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
string PayPalRequest = "TRXTYPE=S" + "&TENDER=C" + "&ACCT=" + txtCardNumber.Text + "&EXPDATE=" + ddlMonth.SelectedValue +
ddlYear.SelectedValue.Substring(2, 2)
+ "&CVV2=" + txtCvv.Text + "&AMT=" + txtAmount.Text
+ "&COMMENT1=My Product Sale"
+ "&USER=" + ConfigurationManager.AppSettings["USER"]
+ "&VENDOR=" + ConfigurationManager.AppSettings["VENDOR"]
+ "&PARTNER=" + ConfigurationManager.AppSettings["PARTNER"]
+ "&PWD=" + ConfigurationManager.AppSettings["PWD"];
PayflowNETAPI PayflowNETAPI = new PayflowNETAPI();
string PayPalResponse = PayflowNETAPI.SubmitTransaction
(PayPalRequest, PayflowUtility.RequestId);
NameValueCollection RequestCollection =
GetPayPalCollection(PayflowNETAPI.TransactionRequest);
NameValueCollection ResponseCollection = GetPayPalCollection(PayPalResponse);
lblResult.Text = "<span class=\"heading\">
PayPal Payflow Pro transaction request</span><br />";
lblResult.Text += ShowPayPalInfo(RequestCollection);
lblResult.Text += "<br /><br /><span class=\"heading\">
PayPal Payflow Pro transaction response</span><br />";
lblResult.Text += ShowPayPalInfo(ResponseCollection);
string TransErrors = PayflowNETAPI.TransactionContext.ToString();
if (TransErrors != null && TransErrors.Length > 0)
{
lblResult.Text += "<br /><br /><span class=\"bold-text\">
Transaction Errors:</span> " + TransErrors;
}
lblResult.Text += "<br /><br /><span class=\"bold-text\">
Status:</span> " + PayflowUtility.GetStatus(PayPalResponse);
}
catch (Exception ex)
{
lblError.Text = ex.Message.ToString();
}
}
private NameValueCollection GetPayPalCollection(string payPalInfo)
{
NameValueCollection PayPalCollection =
new System.Collections.Specialized.NameValueCollection();
string[] ArrayReponses = payPalInfo.Split('&');
for (int i = 0; i < ArrayReponses.Length; i++)
{
string[] Temp = ArrayReponses[i].Split('=');
PayPalCollection.Add(Temp[0], Temp[1]);
}
return PayPalCollection;
}
private string ShowPayPalInfo(NameValueCollection collection)
{
string PayPalInfo = "";
foreach (string key in collection.AllKeys)
{
PayPalInfo += "<br /><span class=\"bold-text\">" +
key + ":</span> " + collection[key];
}
return PayPalInfo;
}
}