Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Surcharge On Paypal Express Rate Topic   - - - - -

 
  • shikhar
  • Senior Member
  • Members
  • Join Date: 09-Oct 11
  • 156 posts

Posted 18 March 2014 - 09:11 AM #1

Hi Guys,

Is surcharge on Paypal express checkout not working anymore.

It was find with 3.x, after upgrading to 4.x I started getting the following error with 4% surcharge.

Error 10413 Transaction refused because of an invalid argument. See additional error messages for details.: The totals of the cart item amounts do not match order amounts.

Any clue ?

regds,
Shikhar
Cs-cart tips at shikhar.me

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19709 posts

Posted 18 March 2014 - 10:07 AM #2

@shikhar,

Hi. Unfortunately we have no active PayPal Express merchant account. But I have made a quick overview of the code. Please try the following solution:

1. Open the "app/payments/paypal/paypa_express.functions.php"
2. Replace this part of code

foreach ($data['products'] as $product) {
	    if ($product['price'] != 0) {
		    $order_data['L_PAYMENTREQUEST_0_NAME' . $product_index] = $product['product'];
		    $order_data['L_PAYMENTREQUEST_0_NUMBER' . $product_index] = $product['product_code'];
		    $order_data['L_PAYMENTREQUEST_0_DESC' . $product_index] = fn_paypal_get_product_option($product);
		    $order_data['L_PAYMENTREQUEST_0_QTY' . $product_index] = $product['amount'];
		    $order_data['L_PAYMENTREQUEST_0_AMT' . $product_index] = $product['price'];
		    $product_index++;
	    }
    }

with this one:

foreach ($data['products'] as $product) {
	    if ($product['price'] != 0) {
		    $order_data['L_PAYMENTREQUEST_0_NAME' . $product_index] = $product['product'];
		    $order_data['L_PAYMENTREQUEST_0_NUMBER' . $product_index] = $product['product_code'];
		    $order_data['L_PAYMENTREQUEST_0_DESC' . $product_index] = fn_paypal_get_product_option($product);
		    $order_data['L_PAYMENTREQUEST_0_QTY' . $product_index] = $product['amount'];
		    $order_data['L_PAYMENTREQUEST_0_AMT' . $product_index] = $product['price'];
		    $product_index++;
	    }
    }
if (floatval($data['payment_surcharge'])) {
		 $order_data['L_PAYMENTREQUEST_0_NAME' . $product_index] = __('surcharge');
		    $order_data['L_PAYMENTREQUEST_0_NUMBER' . $product_index] = 'SURCHARGE';
		    $order_data['L_PAYMENTREQUEST_0_DESC' . $product_index] = __('payment_surcharge');
		    $order_data['L_PAYMENTREQUEST_0_QTY' . $product_index] = 1;
		    $order_data['L_PAYMENTREQUEST_0_AMT' . $product_index] = $data['payment_surcharge'];
		    $product_index++;
}
3. Save the file and check the result.

Let me know the result, please.

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • shikhar
  • Senior Member
  • Members
  • Join Date: 09-Oct 11
  • 156 posts

Posted 18 March 2014 - 10:40 AM #3

Thanks ecom,

It worked with one more code edit, a line after your code snippet.


	//$order_data['PAYMENTREQUEST_0_ITEMAMT'] = empty($data['subtotal_discount']) ? $data['subtotal'] : $data['subtotal'] - $data['subtotal_discount'];	

	$order_data['PAYMENTREQUEST_0_ITEMAMT'] = empty($data['subtotal_discount']) ? ($data['subtotal'] + $data['payment_surcharge']) : ($data['subtotal']+$data['payment_surcharge']) - $data['subtotal_discount'];

Cs-cart tips at shikhar.me

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19709 posts

Posted 18 March 2014 - 11:12 AM #4

@shikhar,

Thanks for the comment. Hope it will be useful for community.

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • NairdaCart
  • Senior Member
  • Members
  • Join Date: 18-Jul 11
  • 306 posts

Posted 20 March 2014 - 07:49 AM #5

You may want to read the T & C's you agreed to when creating your PayPal account. They do vary from country to country but in mine you are not allowed to charge a surcharge for accepting PayPal.

 
  • Webrunner
  • Member
  • Members
  • Join Date: 06-Dec 06
  • 68 posts

Posted 10 November 2014 - 09:19 AM #6

Thanks eComLabs and shikhar, I needed this fix for a client of mine!

Authorized Reseller Bitcoin accepted!
CS-Cart $345 - Ultimate $775 - Multi-Vendor $1250 https://sprintweb.nl