• Resolved ramil0001

    (@ramil0001)


    We have a problem with rounding, we often get an error that the cost doesn't match. Sometimes it allows us to pay for the order sometimes it doesn't
    
    
    2024-01-29T14:35:59+00:00 DEBUG <------------------- WebToffee PayPal Express Payment ( Setting Express Checkout ) ------------------->
    stdClass Object
    (
        [METHOD] => SetExpressCheckout
      
        [LOCALECODE] => de_DE
        [LANDINGPAGE] => Billing
        [L_PAYMENTREQUEST_0_NAME0] => Santino Arte Pflanzt?pfe ? 22 cm, H 20 cm Menthol/Wei? x 1
        [L_PAYMENTREQUEST_0_DESC0] => 
        [L_PAYMENTREQUEST_0_AMT0] => 5.37
        [L_PAYMENTREQUEST_0_NAME1] => Santino Arte Pflanzt?pfe ? 16.5 cm, H 15 cm Menthol/Wei? x 1
        [L_PAYMENTREQUEST_0_DESC1] => 
        [L_PAYMENTREQUEST_0_AMT1] => 3.35
        [L_PAYMENTREQUEST_0_NAME2] => Santino Arte Pflanzt?pfe ? 13.5 cm, H 12.5 cm Menthol/Wei? x 1
        [L_PAYMENTREQUEST_0_DESC2] => 
        [L_PAYMENTREQUEST_0_AMT2] => 2.51
        [PAYMENTREQUEST_0_AMT] => 19.27
        [PAYMENTREQUEST_0_CURRENCYCODE] => EUR
        [PAYMENTREQUEST_0_ITEMAMT] => 11.23
        [PAYMENTREQUEST_0_SHIPPINGAMT] => 4.96
        [PAYMENTREQUEST_0_TAXAMT] => 3.08
        [PAYMENTREQUEST_0_SHIPDISCAMT] => -0.01
        [PAYMENTREQUEST_0_PAYMENTACTION] => Sale
        [MAXAMT] => 34.27
     Weg 9b
        [PAYMENTREQUEST_0_SHIPTOSTREET2] => 
        [PAYMENTREQUEST_0_SHIPTOCITY] => M?lln
        [PAYMENTREQUEST_0_SHIPTOSTATE] => 
        [PAYMENTREQUEST_0_PAYMENTREQUESTID] => 28447
    )
    
    
    
    2024-01-29T14:36:00+00:00 DEBUG <------------------- WebToffee PayPal Express Payment ( Response on Express Start/Credit Start ) ------------------->
    
    stdClass Object
    
    (
    
    ? ? [TIMESTAMP] => 2024-01-29T14:36:00Z
    
    ? ? [CORRELATIONID] => 6555c56a33067
    
    ? ? [ACK] => Failure
    
    ? ? [BUILD] => 58322870
    
    ? ? [L_ERRORCODE0] => 10413
    
    ? ? [L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
    
    ? ? [L_LONGMESSAGE0] => The totals of the cart item amounts do not match order amounts.
    
    ? ? [L_SEVERITYCODE0] => Error
    
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @ramil0001,

    Greetings from Webtoffee!

    Are you using any third-party plugins to alter your cart amount? To better understand your system environment, we would like to view your?WooCommerce System status report?(WooCommerce > Status > Get system status report).
    ?

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    HI @ramil0001,

    As per the details you shared in our website support desk we developed a solution for compensating the amount mismatch. The code snippet provided below will correct the mismatch and add a discount or line to make the line item total equal to the order total.?

    Try this solution after activating our plugin in your site’s active child themes functions.php and see how it goes.

    add_filter('wt_paypal_request_params', 'wt_pklist_change_invoice_date_format');
    
    function wt_pklist_change_invoice_date_format($params)
    {
        $count = 0;
    
        foreach ($params as $key => $value) {
            if (preg_match('/L_PAYMENTREQUEST_0_AMT(\d+)/', $key, $matches)) {
                $index = intval($matches[1]);
                if ($index > $count) {
                    $count = $index;
                }
            }
        }
    
        $count++;
    		
        $total_item_amt = $params['PAYMENTREQUEST_0_ITEMAMT'];
        $total_tax_amt = $params['PAYMENTREQUEST_0_TAXAMT'];
    	$total_shipAMT = $params['PAYMENTREQUEST_0_SHIPPINGAMT'];
        $total_shipdisc_amt = $params['PAYMENTREQUEST_0_SHIPDISCAMT'];
        $total_amt = ($total_item_amt + $total_tax_amt + $total_shipAMT) - $total_shipdisc_amt;
        $difference = $total_amt - $params['PAYMENTREQUEST_0_AMT'];
    						 $decoded_data = $difference;
    	if(0 !== $difference ){
    	
    			if ($difference > 0) {
    			$params['PAYMENTREQUEST_0_SHIPDISCAMT'] = $total_shipdisc_amt + abs($difference);
    			}
    
    			else {
    				$params["L_PAYMENTREQUEST_0_AMT$count"] = abs($difference);
    				$params["L_PAYMENTREQUEST_0_NAME$count"] ='Extra line item';
    				$params["L_PAYMENTREQUEST_0_DESC$count"] = 'for amount mismatch';
    				$params['PAYMENTREQUEST_0_ITEMAMT'] = $total_item_amt + abs($difference);
    
    
    			}
    	}
                   
        return $params;
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘10413 The totals of the cart item amounts do not match order amounts.’ is closed to new replies.