Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStoreHow to tell what my customer purchasedHow to tell what my customer purchased
Previous
 
Next
New Post
11/14/2006 8:52 AM
 
There are a lot of modifications needed in the paypal provider, and to be honest I don't remember what the original code looked like so I can't explicity list the "changes" you need to make.

I decided to implement a POST rather than a GET, which means an extra page in the payment process, the content of this extra page is a thank you message followed by an invitaion to procedd to paypal.

I used the PayPal developers guide to get the correct field names that need to be in the page, the result of which is this method, which outputs paypal data to the new page:

private void SetupPayPalFields()
        {
            IAddressInfo shippingAddress = CheckoutControl.ShippingAddress;
            IAddressInfo billingAddress = CheckoutControl.BillingAddress;

            OrderInfo orderInfo = CheckoutControl.GetOrderDetails();

            //Set the paypal url as form target
            btnContinue.PostBackUrl = _paymentURL;

            string returnURL = Request.Url + "&PayPalExit=return";
            string cancelURL = Request.Url + "&PayPalExit=cancel";
            string notifyURL = Request.Url + "&PayPalExit=notify";

            AddHiddenField("cmd", "_cart");
            AddHiddenField("upload", "1");
            AddHiddenField("business", _settings.PayPalID);
            AddHiddenField("handling_cart", orderInfo.ShippingCost.ToString("0.00"));
            AddHiddenField("currency_code", _settings.Currency);
            AddHiddenField("invoice", orderInfo.OrderID.ToString());
            AddHiddenField("return", returnURL);
            AddHiddenField("cancel_return", cancelURL);
            AddHiddenField("notify_url", notifyURL);
            AddHiddenField("rm", "2");
            AddHiddenField("lc", "GB");
            AddHiddenField("cbt", "Back to " + PortalSettings.PortalName);

            //Tax...
            if (orderInfo.Tax > 0)
            {
                AddHiddenField("tax_cart", orderInfo.Tax.ToString("0.00"));
            }

            //Cart Contents...
            ArrayList cartItems = CurrentCart.GetItems(PortalId);
            int itemNumber = 1;
            foreach (ItemInfo itemInfo in cartItems)
            {
                AddHiddenField("item_name_" + itemNumber.ToString(), itemInfo.Manufacturer + (itemInfo.Manufacturer.Length > 0 ? " " : "") + itemInfo.ModelName);
                AddHiddenField("quantity_" + itemNumber.ToString(), itemInfo.Quantity.ToString());
                AddHiddenField("amount_" + itemNumber.ToString(), itemInfo.UnitCost.ToString("0.00"));
                itemNumber++;
            }

            //Customer Address...
            AddHiddenField("email", UserInfo.Membership.Email);
            AddHiddenField("first_name", GetFirstName(billingAddress.Name));
            AddHiddenField("last_name", GetSurname(billingAddress.Name));
            AddHiddenField("address1", billingAddress.Address1);
            AddHiddenField("address2", billingAddress.Address2);
            AddHiddenField("city", billingAddress.City);
            AddHiddenField("zip", billingAddress.PostalCode);
            AddHiddenField("country", (billingAddress.CountryCode.Equals("United Kingdom") ? "GB" : billingAddress.CountryCode));

            AddHiddenField("business_cs_email", UserInfo.Membership.Email);
            AddHiddenField("business_address1", billingAddress.Address1);
            AddHiddenField("business_address2", billingAddress.Address2);
            AddHiddenField("business_city", billingAddress.City);
            AddHiddenField("business_zip", billingAddress.PostalCode);
            AddHiddenField("business_country", billingAddress.CountryCode);
        }

private void AddHiddenField(string name, string value)
        {
            System.Web.UI.HtmlControls.HtmlInputHidden htmlHidden = new System.Web.UI.HtmlControls.HtmlInputHidden();
            htmlHidden.ID = name;
            htmlHidden.Name = name;
            htmlHidden.Value = value;
            Page.Form.Controls.Add(htmlHidden);
        }

You'll need to handle the return from paypal too, and will also have to add a "go to paypal" button which posts the form to the paypal url (btnContinue in the example code above).

There are likely more issues that I've forgotten about, please take this as a starting point rather than an exaustive solution.
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStoreHow to tell what my customer purchasedHow to tell what my customer purchased


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out