Fixed Payment provider returning Error: Invalid cost amount

tjoneslow

New member
Affected version
XF 2.2
We've set up PayPal to accept payments for forum upgrades according to the documentation. But one user attempt to upgrade continues to post an error log with the error message: Error: Invalid cost amount

I did a search for similar errors and found this as a fixed bug against 2.0.5;


array(42) { ["mc_gross"] => string(5) "57.10" ["protection_eligibility"] => string(8) "Eligible" ["address_status"] => string(9) "confirmed" ["payer_id"] => string(13) "" ["address_street"] => string(15) "" ["payment_date"] => string(25) "" ["payment_status"] => string(9) "Completed" ["charset"] => string(12) "windows-1252" ["address_zip"] => string(10) "" ["first_name"] => string(3) "" ["mc_fee"] => string(4) "2.48" ["address_country_code"] => string(2) "US" ["address_name"] => string(10) "" ["notify_version"] => string(3) "3.9" ["custom"] => string(32) "" ["payer_status"] => string(8) "verified" ["business"] => string(19) "" ["address_country"] => string(13) "" ["address_city"] => string(6) "" ["quantity"] => string(1) "1" ["verify_sign"] => string(56) "" ["payer_email"] => string(28) "" ["txn_id"] => string(17) "" ["payment_type"] => string(7) "instant" ["last_name"] => string(6) "" ["address_state"] => string(2) "" ["receiver_email"] => string(19) "" ["payment_fee"] => string(4) "2.48" ["shipping_discount"] => string(4) "0.00" ["insurance_amount"] => string(4) "0.00" ["receiver_id"] => string(13) "" ["txn_type"] => string(10) "web_accept" ["item_name"] => string(56) "Account upgrade: Moot Subscription - Count (ShadowHawke)" ["discount"] => string(4) "0.00" ["mc_currency"] => string(3) "USD" ["item_number"] => string(0) "" ["residence_country"] => string(2) "US" ["shipping_method"] => string(11) "Air Service" ["transaction_subject"] => string(0) "" ["payment_gross"] => string(5) "57.10" ["shipping"] => string(4) "7.10" ["ipn_track_id"] => string(13) "" }
 
We figured this out. I'm posting this here in hopes it helps others resolve a similar problem.

In your PayPal setup it is possible to add additional charges. In our example the PayPal setup was part of an online store. This was set to automatically add a small shipping and handling charge to the amount requested. For the store the user selects the item(s), is redirected to to the PayPal site, where they see the additional charge for shipping and can approve or disapprove from there.

In the XenForo case, the XenForo API sends over the request for $X, the shipping charges are added, and is told the user is going to be charged $X+Shipping. XenForo correctly complains.

The solution was to set up a second PayPal email address to the same account, but this one wouldn't add the shipping. This resolved the problem.

Another problem is XenForo keeps trying this transaction. In an ideal world I would love to see one of the following outcomes:
  • XenForo simply stops after the first failure in this circumstance. If the first time this fails, it will continue to do so until manually addressed.
  • There is a better error message indicating the problem and how to address it.
For a real stretch goal, have the ability to indicate there will be an additional charge for shipping, taxes, handling, etc of not more than $Y
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.8).

Change log:
When encountering an invalid cost amount error with PayPal, expand the error message with a hint to check for additional shipping and handling charges
There may be a delay before changes are rolled out to the XenForo Community.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.8).

Change log:

There may be a delay before changes are rolled out to the XenForo Community.

has this been fixed? I just ran across this issue but am on 2.2.12
 
has this been fixed? I just ran across this issue but am on 2.2.12
i guess you changed the metric manually from paypal
before that everything was fine, until there was a metric change in the autopay section,
for example price increase
because when changing the number in the payment of xenforo, the amount still works automatically at the old value, only change the new one after you change the value in paypal
and started having problems Error: Invalid cost amount
 
Top Bottom