News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

paypal with coupon

Started by Hedo, August 03, 2009, 16:07:29 PM

Previous topic - Next topic

Hedo

Hello, i've a problem with paypal with coupon  transaction, because i received this message:


During a paypal transaction on your site the received amount didn't match the order total.

                    Order ID: 38.

                    Order Number: 78_559a78326f65e2f466977602be91d.

                    The amount received was: 221.14 EUR.

                    It should be: 222.2 EUR.



During a paypal transaction on your site the received amount didn't match the order total.

                    Order ID: 32.

                    Order Number: 69_bcf4f3aba93de517d519e99f458fb.

                    The amount received was: 104.68 EUR.

                    It should be: 105.41 EUR.


i received this error only with transaction whit paypal+coupon (the coupon value is 5% of total amout)

this one is my code for paypal module.
<?php
$db1 
= new ps_DB();
$q "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$user->country."' ORDER BY country_2_code ASC";
$db1->query($q);

//$url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
$url "https://www.paypal.com/cgi-bin/webscr";

$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_xclick",
"upload" => "1",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": "$db->f("order_id"),
"order_id" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"amount" => round$db->f("order_subtotal")+$tax_total-$discount_total2),
"shipping" => sprintf("%.2f"$db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],

"address_override" => "1",
"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address1" => $dbbt->f('address_1'),
"address2" => $dbbt->f('address_2'),
"zip" => $dbbt->f('zip'),
"city" => $dbbt->f('city'),
"state" => $dbbt->f('state'),
"country" => $db1->f('country_2_code'),
"email" => $dbbt->f('user_email'),
"night_phone_b" => $dbbt->f('phone_1'),
"cpp_header_image" => $vendor_image_url,

"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php",
"undefined_quantity" => "0",

"test_ipn" => PAYPAL_DEBUG,
"pal" => "NRUBJXESJTY24",
"no_shipping" => "1",
"no_note" => "1"
);
if( 
$page == "checkout.thankyou" ) {
$query_string "?";
foreach( 
$post_variables as $name => $value ) {
$query_string .= $name"=" urlencode($value) ."&";
}
vmRedirect$url $query_string );
} else {
echo 
'<form action="'.$url.'" method="post" target="_blank">';
echo 
'<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" alt="Click to pay with PayPal - it is fast, free and secure!" />';

foreach( 
$post_variables as $name => $value ) {
echo 
'<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo 
'</form>';

}
?>


maybe i modify this line:"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),

but i dont know to do it :/


volksman3

I have the same issue and think it is also something to do with that line but not sure how to change it - did you every find a fix?
Parachutes are like minds, they only work when they are open!
http://www.akirastudio.co.uk

rossi256

I think i have the same problem!

The problem is, that Virtuemart calculates the coupon discount from the products but not from shipping costs.
Paypal or the paypal-code seems to calculate the total amount by subtracting the coupon percentage from the total amount including shipping costs!

Can this be solved by changing the Paypal payment module code??
We need some expert here... please ;)

Thanks!!
Rossi

volksman3

#3
Hi, I believe this could be a configuration issue with the problem of discounting you have. It you go to configuration in the virtuemart menu and then look on the right hand side of the first screen for tax configuration their is an option to 'Subtract payment discount before tax/shipping' with a check box which controls this.

See attached image

Hope that fixes the issue for you  ;)

[attachment cleanup by admin]
Parachutes are like minds, they only work when they are open!
http://www.akirastudio.co.uk

rossi256

No, the problem:
look at this sample calculation:

Product price: €26,90
SubTotal: €22,42
Tax Total: €4,03
Shipping and Handling Fee: €5,00
Shipping Tax: €0,00
COUPON Discount: - €2,69
Total:    €29,21

However, the customer paid by Paypal and got charged 28,76 EUR
Product: 23,76 EUR
Subtotal: 23,76 EUR
Shipping and handling: 5,00 EUR
Total: €28,76 EUR
Payment:€28,76 EUR

So there must be a problem in the handling of the Coupon and/or forwarding to Paypal...!?

This PAYMENT amount in Paypal doesn't change even when changing the option "subtract payment discount before tax/shipping", but with the option enabled, the VM order total matches the Paypal payment.

However, i do not understand how to get to 23,76 EUR or 28,76 EUR TOTAL???

The product has 20% tax // shipping costs have 0% tax.

anybody??
all best
Rossi

hotelathome

#5
I am having the same problem.
A $60 item with a 10% discount coupon is $54 then I ad $10 for shipping. The Total in virtumart is $64 but when you proceed to paypal, it says that the Item value is $54.37 and the shipping is $9.09 showing a total $63.46
I have the same problem when there is no discount coupon used, a $60 item and $10 postage ($70) shows up on paypal as $60.91 item and $9.09 postage ($70) but at least it adds up to the same amount.

product has 10% tax // shipping has 10% tax

rossi256

Can somebody check if that is a bug - or should we post it in the bugtracker??

hotelathome

#7
The problem only gets worse when the 'Subtract payment discount before tax/shipping' is checked.
the checkout figures are fine, but then the paypal figures are wrong AND the figures that the customer sees if they log into their account from the front end are also wrong and the figures in the backend are wrong.
It probably is some kind of bug.

see what i mean here
http://forum.virtuemart.net/index.php?topic=63776.msg211080#msg211080

hotelathome

I am sure this is a bug.
I dont know how to post it to bug tracker, but if you know how to, please do.

p.barg

#9
I also think that it is a bug. It seems to be the tax amount of the coupon
that is missing in the PayPal amount, but I'm still looking for the solution...

-- Petra

mwf

Please see my post http://forum.virtuemart.net/index.php?topic=63853.msg213241#msg213241

There are bugs in several areas when coupons/payment discounts are being used.

I believe I have solved the issues with the solution posted on my site - link in forum post - READ THE ARTICLE FIRST - there are still some gotchas.
Professional Joomla Development and Support
http://www.exps.ca