Skip to content

Instantly share code, notes, and snippets.

@fastdivision
Created August 11, 2016 20:53
Show Gist options
  • Save fastdivision/be581f99ccb93dc04608cd25de207378 to your computer and use it in GitHub Desktop.
Save fastdivision/be581f99ccb93dc04608cd25de207378 to your computer and use it in GitHub Desktop.
<?php
require __DIR__ . '/vendor/autoload.php';
$taxjar = TaxJar\Client::withApiKey('YOUR API TOKEN');
$order_taxes = $taxjar->taxForOrder([
'from_country' => 'US',
'from_zip' => '07001',
'from_state' => 'NJ',
'to_country' => 'US',
'to_zip' => '07446',
'to_state' => 'NJ',
'amount' => 16.50,
'shipping' => 1.5,
'line_items' => [
[
'quantity' => 1,
'unit_price' => 15.0,
'product_tax_code' => 31000
]
]
]);
echo $order_taxes->amount_to_collect;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment