Paypal standard fix - allows showing of items in cart

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
ttun76 wrote:
Hello BFranklin,

I just realized that when a discount is applied to the order, the discounted amount is not passed over to paypal at all (as if there was no discount). How can i fix this issue?

Thanks


Are you using the code in this post or the code here:

https://www.nopcommerce.com/boards/t/5876/paypal-standard-fix-allows-showing-of-items-in-paypal.aspx?p=2


The code at the link above is better. The final code is on the second page of that post.

What happens is if you send TAX to Paypal it will ignore the discount - I don't know why. The work-around that I came up with is either have Paypal do your tax or send tax as an item and NOT AS TAX, then Paypal will recognize the discount.
13 years ago
Hi Bfranklin,

I copied that set of codes from the link you provided above and found errors after i compile the solution. the errors came from these lines:

   //the checkout attributes that have a dollar value and send them to Paypal as items to be paid
          for
              var caValues = CheckoutAttributeHelper.ParseCheckoutAttributeValues
                  (order.CheckoutAttributesXml);
              foreach (var val in caValues)
              {
                  var attPrice = TaxManager.GetCheckoutAttributePrice(val, false, NopContext.Current.User);
                  if (attPrice > 0) //if it has a price
                  {
                      var caName = CheckoutAttributeManager.GetCheckoutAttributeById(val.CheckoutAttributeId);
                      var attName = caName.LocalizedName; //set the name
                      builder.AppendFormat("&item_name_" + x + "={0}", attName); //name
                      builder.AppendFormat("&amount_" + x + "={0}", attPrice); //amount
                      builder.AppendForma&quantity_" + x + "={0}", 1); //quantity
                  x++;
              }
      }

the errors came from the underlined.
13 years ago
ttun76 wrote:
Hi Bfranklin,

I copied that set of codes from the link you provided above and found errors after i compile the solution. the errors came from these lines:

   //the checkout attributes that have a dollar value and send them to Paypal as items to be paid
         for              var caValues = CheckoutAttributeHelper.ParseCheckoutAttributeValues
                  (order.CheckoutAttributesXml);
              foreach (var val in caValues)
              {
                  var attPrice = TaxManager.GetCheckoutAttributePrice(val, false, NopContext.Current.User);
                  if (attPrice > 0) //if it has a price
                  {
                      var caName = CheckoutAttributeManager.GetCheckoutAttributeById(val.CheckoutAttributeId);
                      var attName = caName.LocalizedName; //set the name
                      builder.AppendFormat("&item_name_" + x + "={0}", attName); //name
                      builder.AppendFormat("&amount_" + x + "={0}", attPrice); //amount
                      builder.AppendForma&quantity_" + x + "={0}", 1); //quantity
                  x++;
              }
      }

the errors came from the underlined.


Take out the first "for", that should not be there and is not in the code.
13 years ago
Thanks,

I took it out, but there is still one error:

//the checkout attributes that have a dollar value and send them to Paypal as items to be paid for

              var caValues = CheckoutAttributeHelper.ParseCheckoutAttributeValues
                  (order.CheckoutAttributesXml);
              foreach (var val in caValues)
              {
                  var attPrice = TaxManager.GetCheckoutAttributePrice(val, false, NopContext.Current.User);
                  if (attPrice > 0) //if it has a price
                  {
                      var caName = CheckoutAttributeManager.GetCheckoutAttributeById(val.CheckoutAttributeId);
                      var attName = caName.LocalizedName; //set the name
                      builder.AppendFormat("&item_name_" + x + "={0}", attName); //name
                      builder.AppendFormat("&amount_" + x + "={0}", attPrice); //amount
                      builder.AppendForma&quantity_" + x + "={0}", 1); //quantity
                      x++;
             }
      }

Thanks in advance.

The error lies in the quantity an gave the option of:

Generate property stub for 'quantity_'in 'NopSolutions.Nopcommerce.Payment.Methods.Paypal.PayPalStandardPaymentProcessor'

or

Generate field stub for 'quantity_' in 'NopSolutions.NopCommerce.Payment.Methods.Paypal.PayPalStandardPaymentProcessor'
13 years ago
I figured it out.

the code:

{
                      var caName = CheckoutAttributeManager.GetCheckoutAttributeById(val.CheckoutAttributeId);
                      var attName = caName.LocalizedName; //set the name
                      builder.AppendFormat("&item_name_" + x + "={0}", attName); //name
                      builder.AppendFormat("&amount_" + x + "={0}", attPrice); //amount
                      builder.AppendForma&quantity_" + x + "={0}", 1); //quantity
                      x++;
             }

should be:

  {
                      var caName = CheckoutAttributeManager.GetCheckoutAttributeById(val.CheckoutAttributeId);
                      var attName = caName.LocalizedName; //set the name
                      builder.AppendFormat("&item_name_" + x + "={0}", attName); //name
                      builder.AppendFormat("&amount_" + x + "={0}", attPrice); //amount
                      builder.AppendFormat("&quantity_" + x + "={0}", 1); //quantity
                      x++;
             }

just a minor typo. Thanks
13 years ago
This code is a great feature, well done. I am stuck with version 1.40 at the moment because my shared hosting plan doesn't allow for Full Trust and I'm loathe to change hosts right at this moment. The code doesn't work with 1.40 because it throws up 12 errors, mainly missing references. Is it possible to add the missing files from 1.70 to 1.40 or am I just giving myself further headaches?
13 years ago
ttun76 wrote:
I figured it out.

just a minor typo. Thanks


I am prone to typos... :)
13 years ago
hinckleytrader wrote:
Is it possible to add the missing files from 1.70 to 1.40 or am I just giving myself further headaches?


I wouldn't even know where to start... I didn't come across nopCommerce until 1.60, I have no idea what 1.40 is like.

Sorry...
13 years ago
Barry,

I just realized on a test order, there is a difference in the way the tax is calculate on the nopcommerce site and the paypal site using that code (although i am not sure if it was the code or just nop configuration).

Before passing to Paypal (nopcommerce side):

Sub-Total:     $21.95
Discount:   -$1.10
Shipping:   $3.95
Tax:     $2.14

Total:   $26.94


After passing to Paypal:
    
Sub-Total:   $21.95    
Discount:  -$1.10   
Item total:   $20.85   
tax:     $2.03   
Shipping:   $3.95   

Total:   $26.83   

Looks like in the nopcommerce side, the tax is applied to the order total before discount and once passed to paypal, the tax is applied after the discounted item giving a difference of 0.4%. Is there a fix for this? Small difference, but can cause customer to cancel orders.  Any thougts?  Thanks in advance.
13 years ago
ttun76 wrote:
I just realized on a test order, there is a difference in the way the tax is calculate on the nopcommerce site and the paypal site using that code (although i am not sure if it was the code or just nop configuration).

As far as I know, I didn't mess with anything in nopCommerce that had to do with taxes or discounts... I just took what was given to me by nopCommerce and passed it to Paypal. It must be nopCommerce's way of calculating stuff. I believe that a discount SHOULD be taken BEFORE any taxes are applied - if it is actually a discount - because a discount is like a sale. But if it is a gift certificate then it should be taken off AFTER the taxes are applied - because a gift certificate is just like cash.

The question is: should reward points and gift cerificates be treated the same way - like cash?

ttun76 wrote:

Looks like in the nopcommerce side, the tax is applied to the order total before discount and once passed to paypal, the tax is applied after the discounted item giving a difference of 0.4%. Is there a fix for this? Small difference, but can cause customer to cancel orders.  Any thougts?  Thanks in advance.

I would think that customers would like getting more of a discount once they get to Paypal :) But then you are rigtht, if there is a difference, no matter what the difference is some customers will be scared away. I'll have to look into the best way to do this.

The quick way of doing it (that I think can be done) is not having Paypal add tax. If you send everything to Paypal there won't be a discrepency between the two totals. I don't like that answer either, because I like having Paypal just add the tax so I don't have to fool with it, but it should work that way.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.