Hi David,
We implemented PayPal advanced for one of our clients a couple of months ago. In order to implement PayPal advanced you would need implement a custom
payment page in AbleCommerce which will display the PayPal advanced payment form in iframe and another page that should handle PayPal advanced responses
and complete the order process in AbleCommerce. The implementation is not straight forward (copy/paste code snippet) and does require changes to the
order checkout logic based on your store checkout customization. You would need to implement the following logic:
- as soon as you have the order details request SECURETOKEN and SECURETOKENID using HTTP request to
https://payflowpro.paypal.com:443
Code: Select all
private const string PayFlowKeyRequestTestUrl = "https://pilot-payflowpro.paypal.com:443";
private const string PayFlowKeyRequest = "https://payflowpro.paypal.com:443";
private const string PayFlowUrl = "https://payflowlink.paypal.com"; // PayPay Advanced Payment Form URL
private const string PayPalCurrency = "USD";
private const string PayPalVerbosity = "HIGH"; //"HIGH" => return all data
private const string PayPalTransType = "S"; //"A" => Authorization, "S" => Sale
...
httpost.Encode = "utf-8";
httpost.AddPostKey("PARTNER", Drundo.Helper.Configurations.GetValue("PayflowProPartner"));
httpost.AddPostKey("VENDOR", Drundo.Helper.Configurations.GetValue("PayflowProVendor"));
httpost.AddPostKey("USER", Drundo.Helper.Configurations.GetValue("PayflowProUser"));
httpost.AddPostKey("PWD", Drundo.Helper.Configurations.GetValue("PayflowProPassword"));
httpost.AddPostKey("TRXTYPE", PayPalTransType);
httpost.AddPostKey("CREATESECURETOKEN", "Y");
httpost.AddPostKey("SECURETOKENID", PayflowUtility.RequestId);
httpost.AddPostKey("CURRENCY", Drundo.Helper.Configurations.GetValue("PaymentCurrency"));
httpost.AddPostKey("AMT", bAmount);
httpost.AddPostKey("BILLTOFIRSTNAME", m_FirstName);
httpost.AddPostKey("BILLTOLASTNAME", m_LastName);
httpost.AddPostKey("BILLTOSTREET", m_Street);
httpost.AddPostKey("BILLTOCITY", m_City);
httpost.AddPostKey("BILLTOSTATE", m_State);
httpost.AddPostKey("BILLTOZIP", m_Zip);
httpost.AddPostKey("BILLTOCOUNTRY", m_Country);
httpost.AddPostKey("INVNUM", m_OrderNumber);
...
...
- then you have to create PayPal payment page URL in iframe:
Code: Select all
<iframe id="uxPaymentFrame" runat="server" width="495px" height="600px" frameborder="0" scrolling="no"></iframe>
string[] token = ResponseCollection.GetValues("SECURETOKEN");
string[] tokenid = ResponseCollection.GetValues("SECURETOKENID");
if (token.Length > 0 && tokenid.Length > 0)
{
StringBuilder iframesrc = new StringBuilder();
iframesrc.AppendFormat("{0}?", PayFlowUrl);
if (testmode)
{
iframesrc.Append("MODE=TEST&");
}
else
{
iframesrc.Append("MODE=LIVE&");
}
iframesrc.AppendFormat("SECURETOKENID={0}&SECURETOKEN={1}", tokenid[0], token[0]);
response = iframesrc.ToString();
- You have to implement additional logic as part of the Receipt page and complete the order based on the response code returned from PayPal
Code: Select all
string errormsg = Page.Request.QueryString["RESPMSG"];
string errorcode = Page.Request.QueryString["RESULT"];
string orderid = Page.Request.QueryString["INVNUM"];
string reference = Page.Request.QueryString["PNREF"];
string avsdata = Page.Request.QueryString["AVSDATA"];
string transtime = Page.Request.QueryString["TRANSTIME"];
string authcode = Page.Request.QueryString["AUTHCODE"];
More information is available in the PayFlow Guide here:
https://cms.paypal.com/cms_content/US/e ... _Guide.pdf