Jump to content
Sign in to follow this  

PayPal IPN and tax

Recommended Posts

Hi all,


I just implemented PayPal IPN v0.951 and am having a few difficulties that I haven't seen addressed in the forums (correct me if I'm wrong).


I've set up tax zones correctly so that a customer in Colorado is charged 2.9% state sales tax. So far, everything's great. But when they check out with PayPal IPN, PayPal adds tax to the total from the shopping cart.


Is there any way to turn off PayPal's tax? I can't find it in the docs. I don't want to turn it off in osCommerce, since the customer's invoice won't reflect the correct tax.

Share this post

Link to post
Share on other sites

Came up with a solution that involves hacking the IPN code.


In catalog/includes/modules/payment/paypalipn.php add the following into the install() function:



tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Add Tax to Amount', 'MODULE_PAYMENT_PAYPALIPN_ADD_TAX_TO_AMOUNT','False', 'Add tax amount to order amount? (will set tax amount to $0 in PayPal)', '6', '5', 'tep_cfg_select_option(array('True', 'False'), ', now())");



and change the keys() function to:



function keys() {






In catalog/checkout_paypalipn.php change everything after the line "$last_order= $insert" to the following:




$paypal_ipn_order_total = $order->info['total'];



$paypal_ipn_shipping_amount = 0.00;

} else {

$paypal_ipn_order_total -= $order->info['shipping_cost'];

$paypal_ipn_shipping_amount = number_format($order->info['shipping_cost'] * $currencies->get_value('USD'), 2);




$paypal_ipn_tax_amount = 0.00;

} else {

$paypal_ipn_order_total -= $order->info['tax'];

$paypal_ipn_tax_amount = number_format($order->info['tax'] * $currencies->get_value('USD'), 2);



$paypal_ipn_order_amount = number_format($paypal_ipn_order_total * $currencies->currencies['USD']['value'], 2);






Now turn PayPal IPN off and back on in the admin interface. You'll have an "Add Tax to Amount" option that works just like the "Add Shipping to Amount"..

Share this post

Link to post
Share on other sites

Pablo, et. al., a "tax" field went live Friday. Third party carts can now specify a fixed tax amount by including a FORM field named "tax" in the PayPal button.

Patrick Breitenbach

Share this post

Link to post
Share on other sites

Hi Patrick and Brad




The taxes now work in the new release of the module!


best regards

Pablo Pasqualino

Mar del Plata, Argentina

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this