Tax API example service

From CommerceV3 Docs

Jump to: navigation, search

CV3 Documentation Resources

<?php
/*****************************************
* Tax Web Service
*
* input:
* $_GET['ship_state']   //ship state (abbrev. in all caps for us anud canada)
* $_GET['ship_zip']     //ship zip-code
* $_GET['bill_state']   //bill state (abbrev. in all caps for us anud canada)
* $_GET['bill_zip']     //bill zip-code
* $_GET['total']        //total order value (doesn't include tax exempt items)
* $_GET['shipping']     //total shipping
* $_GET['order_type']   //'retail' or 'wholesale'
*
* output:
* tax amount for order
*****************************************/

$tax = "0.00";

if ($_GET['ship_state'] == 'GA') {
  $t_amt = ".06";
  $tax += ($_GET['total'] + $_GET['shipping']) * $t_amt;
}

print $tax;

?>
Personal tools