News:

Looking for documentation? Take a look on our wiki

Main Menu

Paypal Aust. Gst amount coming through different to order

Started by em, April 12, 2010, 06:51:11 AM

Previous topic - Next topic

em

Hi,

The order that Virtuemart generates is correct however the Paypal product amount and shipping amount come through different even though the total price is the same.
Virtuemart order
Product $25
Shipping $7.60
Total $32.60
Total Gst $2.96
The Virtuemart order is correct for Australian GST

However

The Paypal amount says
Product $25.69  (product price inc gst + gst from shipping - wt - why would it do that?)
Shipping $6.91 (shipping ex gst)
Total price $32.60

It doesn't matter so much that it doesn't show gst - because the order shows the details - I just need it to show the Product $25 + Shipping $7.60 or if it's easier to show the gst as well that would be even better.

Any help would be sooooooo appreciated!
I'm a bit of a novice when it comes to scripts if that is what I need to edit.
Cheers
EM


stinga

Probably because you are not sending PayPal the correct information. It looks like you are calculating the GST and not letting PP do it. (good)
But you need to make sure the data you send to PP is correct.
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

em

Thanks for replying.
It would be best if the orders have the gst on them for the customers. If the orders are calculated correctly then why would they not send the correct calculation to pp?
Where would I go to change it in the configuration? Currently products are configured to have tax in them which shows on the orders. I think this side of things is fine but the issue must be with the shipping.
I've added a $2 p&h fee in the Australian Post configuration and the tax class I changed to 10% gst.
Perhaps it's the gst on freight that is the issue?
Or do I need to untick virtual tax?
It's strange because both the product and freight are being taxed correctly it's just when the info is sent through to paypay the tax on the freight is added to the product.

I'm hoping I can change this info in the Virtuemart backend rather then having to do a hack as I'm not very confident in that department.

So if you're say I need to make sure the data I send to paypal is correct - well if the orders are correct (from what the customer receives) then why would the data that is being sent not be correct?

There must be a way for the orders to show gst and send that information to pp. I did speak to Paypal and they said it's all to do with the buttons - code that is sent to them which means that pp shouldn't have to calculate the gst they just receive the info from the orders to process it.

Any ideas?

Cheers
EM

stinga

In the PP config on J!/VM there is a text box with code in it (Extra info). This is where the data is extracted from VM and sent to PP. If this is not setup the way you want then you wont get the format you want.
There are posts on the forums on how to get what you want.
You can cut and paste the code here and we can have a look to see what you are sending.
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

em

Here it is.

<?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.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_total, 2),
"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>';

}
?>

Thanks again for helping out.

stinga

G'day,

Here is the important stuff..

$tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"shipping" => sprintf("%.2f", $db->f("order_shipping")),


I think you can see what is happening and how to fix it.
You will need to google for PP tax setting if you want it seperate of look at PP docs at the moment you are only sending amount which includes all tax and shipping, there is a way of send tax separately, I should do this as well.

I think you would need to add...

"tax" => $tax_total,

in there somewhere, after "amount" maybe ?

test well on your test site before letting it loose on the world!
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

em

Ok, finally got it sorted with a bit of help so I thought I'd post the answer for anyone else having the same issue but thanks for pointing me in the right direction Stinga.

The way we went about it was to change the code sent to PP to not include GST just the total amount of the product and shipping. The origional order has gst so the customer can use that for gst purposes.
In the PP configuration these 2 lines needed to be changed from

"amount" => round( $db->f("order_subtotal")+$db->f("order_tax")-$discount_total, 2),

"shipping" => sprintf("%.2f", $db->f("order_shipping")+$db->f("order_shipping_tax")),

to

"amount" => round( $db->f("order_subtotal")+$db->f("order_tax")-$discount_total, 2),

"shipping" => sprintf("%.2f", $db->f("order_shipping")+$db->f("order_shipping_tax")),


Cheers
EM




stinga

Those line all look the same to me... did you get a bit carried away with cut-n-paste?
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

ivanovitchi

oh jeeze looks all double dutch to me!!!

I have just installed and setup a site using Virtuemart with paypal as the preffered payment method.
Ok you may have heard it time and time again but this is my problem

I setup the product in the uk to be for eg

Product costs £30
Shipping      £8 ( depending on weight)
Paypal final fee 3.4% needs to be added to both product and shipping cost

what do i need to modify so paypal adds 3.4% to the final checkout for the customer???

Thanks for any help out there
???

stinga

What is this 3.4%? Is this what PP charge you to process the trx?
This is quite easy really, just take the total cost, calc, 3.4% and add to the original total cost. Beware though because the invoice you send to the customer will no longer match what they are going to pay via PayPal (I am not sure if this is in breach of PP T&Cs).

You would do better just incorporating the 3.4% into the cost of the product, IMHO.
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

linpin

Hi Em

I am using the paypal payment method in Aust too and am having the same problem. Would you be able to post the two lines that you changed or are the ones above the already changed lines?

Thanks.

linpin

Hi

Just wondering if anyone has resolved this? I've tried using the code changes em mentions above but doesn't work.
I've used a configuration from a previous post that allows paypal to show more product information but this hasn't made any difference.
I've attached the configuration, I was wondering if anyone can point out to me what I need to change to get paypal to show the amounts without subtracting the gst amount.

Thanks so much in advance.

[attachment cleanup by admin]