PayPal Payments Advanced

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
dc8johnson
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 87
Joined: Fri Nov 20, 2009 8:46 am

PayPal Payments Advanced

Post by dc8johnson » Mon Aug 20, 2012 4:20 pm

Has anyone implemented PayPal Payments Advanced? Unlike Payments Standard, it doesn't take you off to the PayPal site to collect payment. It's also not like Payments Pro (aka PayFlow Pro) which uses the AbleCommerce checkout/payment pages and makes calls to PayPal behind the scene.

Payments Advanced is supposed to make it look like the customer is making payment on the AbleCommerce site but the actual payment fields are hosted by PayPal. Here's the PayPal comparison:

https://www.paypal.com/webapps/mpp/comp ... s-products

Has anyone used this with AbleCommerce?
David Johnson

User avatar
dgoranov
Lieutenant (LT)
Lieutenant (LT)
Posts: 55
Joined: Sun Jan 16, 2011 3:58 pm
Location: Boston, MA
Contact:

Re: PayPal Payments Advanced

Post by dgoranov » Tue Aug 21, 2012 12:18 pm

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
Dimi Goranov
Drundo Software Inc.
AbleCommerce Hosting and Management
Email: dgoranov@drundo.com
Ph: 888.464.2140

dc8johnson
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 87
Joined: Fri Nov 20, 2009 8:46 am

Re: PayPal Payments Advanced

Post by dc8johnson » Tue Aug 21, 2012 1:04 pm

Dimi,

Thanks very much! What you've provided is very helpful!
David Johnson

Post Reply