Answers.Body: <p>Well, asking the question seems to have helped me find the answer on my own :-)</p>
  
  <p>Turns out that a custom extension for adding a percentage surcharge was not rounding the result of its calculations to two decimal places. Therefore, the total value calculated and sent to PayPal had more than two decimal places in the cents -- which PayPal doesn't accept. However, the DISPLAYED total amount value on the confirmation page DOES round to two decimal places, so it's hard without looking at the actual PayPal data to see the problem.</p>
  
  <p>The form worked fine as long as all the prices were in whole dollars, but the new price item included cents.  Pure percentage calculations with cents were almost always producing surcharge values with hundredths and thousandths of cents.</p>
  
  <p>Putting in a round() function on the offending calculation solved the problem.</p>
  
  <p>Hope this helps someone else! </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-17T13:55:45.443Z
Answers.LastActivityDate: 2015-12-17T13:55:45.443Z
Answers.UserDisplayName: minbori
Body: <p>Strange problem.  I've just added a new price field to the price set on my membership renewal form, and whenever that price field is used, the link to PayPal fails with this error on the PayPal side:</p>
  
  <p>"The link you have used to enter the PayPal system contains an incorrectly formatted item amount."</p>
  
  <p>Any submissions made where there is no data entered for this field work correctly.</p>
  
  <p>I've tried recreating the price field, changing the price, and changing the order of the fields. But the result is the same:  the confirmation pages show correct totals, but if that one line item is included, PayPal throws this error.</p>
  
  <p>Any ideas?</p>
  
Tags: <civicontribute><civimember>
Title: contribution page PayPal error "The link you have used to enter the PayPal system contains an incorrectly formatted item amount"
ThreadText: # contribution page PayPal error "The link you have used to enter the PayPal system contains an incorrectly formatted item amount"
  
  (Asked by: username_0 on 2015-12-17)
  
  Strange problem. I've just added a new price field to the price set on my membership renewal form, and whenever that price field is used, the link to PayPal fails with this error on the PayPal side:
  
  "The link you have used to enter the PayPal system contains an incorrectly formatted item amount."
  
  Any submissions made where there is no data entered for this field work correctly.
  
  I've tried recreating the price field, changing the price, and changing the order of the fields. But the result is the same: the confirmation pages show correct totals, but if that one line item is included, PayPal throws this error.
  
  Any ideas?
  
  **Tags:** civicontribute, civimember
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-12-17. Score: 1
  
  Well, asking the question seems to have helped me find the answer on my own :-)
  
  Turns out that a custom extension for adding a percentage surcharge was not rounding the result of its calculations to two decimal places. Therefore, the total value calculated and sent to PayPal had more than two decimal places in the cents -- which PayPal doesn't accept. However, the DISPLAYED total amount value on the confirmation page DOES round to two decimal places, so it's hard without looking at the actual PayPal data to see the problem.
  
  The form worked fine as long as all the prices were in whole dollars, but the new price item included cents. Pure percentage calculations with cents were almost always producing surcharge values with hundredths and thousandths of cents.
  
  Putting in a round() function on the offending calculation solved the problem.
  
  Hope this helps someone else!
  
  
  ---
  
  