user1278496
user1278496

Reputation: 1066

Passing variables over from basket to Paypal for Payment - VAT charge

I have my own basket which is built up based on what the user buys obviously. This then gets passed over to paypal checkout once the user clicks on checkout. It all works successfully with the item information being displayed in the PayPal cart receipt on the left hand side.

However, I am having an issue with my vat charge cost. I have calculated vat charge (20%) for my basket which works (within my site), but I am not sure how to pass that cost over to Paypal. Currently, Paypal are just calculating the total by adding the items prices depending on their quantities. Any ideas for getting the vat charge to be included in Paypal?

Here is my code:

$product1 = mysql_fetch_assoc($sql1);?>
<input type='hidden' name='item_number_<?php echo $count; ?>' value="<?php echo $count; ?>">
<input type="hidden" name="item_name_<?php echo $count; ?>" value="<?php echo $product1['prod_name']; ?>">
<input type="hidden" name="amount_<?php echo $count; ?>" value="<?php echo $product1['price']; ?>">
<input type='hidden' name='quantity_<?php echo $count; ?>' value="<?php echo $item['quantity']?>">
<?php $count++; } ?>

And here is my shipping code for my basket:

$grand_total = isset($grand_total) ? $grand_total : 0;
  $line_cost = $product['price'] * $item['quantity'];
  $grand_total += $line_cost;
  $charge = $grand_total /100 * 20;
  $chargeincvat = $charge + $grand_total;

<tr><td colspan='6' align='right'>Charges (VAT 20%): &pound; <?=number_format($chargeincvat, 2);?></td></tr>

ADDED:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">

<input type="hidden" name="cmd" value="_cart">

<input type="hidden" name="upload" value="1">

<input type="hidden" name="business"

value="[email protected]">



<input type='hidden' name='item_number_1' value="1">

<input type="hidden" name="item_name_1" value="Moment in Time">

<input type="hidden" name="amount_1" value="6.95">

<input type='hidden' name='quantity_1' value="1">

<input type='hidden' name='tax_cart' value="8.34">

Upvotes: 0

Views: 2223

Answers (2)

Manse
Manse

Reputation: 38147

You can use the following as the name attribute of form elements :

shipping - applies to first item added to cart
shipping2 - applies to each additional item added to cart
handling_cart - applied once to cart regardless of quantity

for example

<input type="hidden" name="handling_cart" value="15.00">

to apply a 15.00 total charge for shipping

To add tax / VAT to an item use tax_# where # is the item number eg

<input type="hidden" name="tax_2" value=".15">

this will add .15p to item number 2. To add a cart tax / VAT use

<input type="hidden" name="tax_cart" value=".15">

See page 263 of this doc and see page 294 of the same document to have the tax / VAT cost automatically calculated

Upvotes: 2

Prabhuram
Prabhuram

Reputation: 1268

you can try sending the shipping info in

input type='hidden' name='shipping' value="25.93"

you can also check here : https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables

Upvotes: 0

Related Questions