taxjar / taxjar-node

Sales Tax API Client for Node
https://developers.taxjar.com/api/reference/?javascript
MIT License
54 stars 24 forks source link

406 (Not Acceptable) shipping is missing #14

Closed protzi closed 6 years ago

protzi commented 6 years ago

Hi, I'm trying an example from the doc and get the error (406 (Not Acceptable) shipping is missing)...

const Taxjar = require('taxjar');

const client = new Taxjar({
  apiKey: '9e0cd62a22f451701f29c3bde214'
});

client.taxForOrder({
  from_country: 'US',
  from_zip: '92093',
  from_state: 'CA',
  from_city: 'La Jolla',
  from_street: '9500 Gilman Drive',
  to_country: 'US',
  to_zip: '90002',
  to_state: 'CA',
  to_city: 'Los Angeles',
  to_street: '1335 E 103rd St',
  amount: 15,
  shipping: 1.5,
  nexus_addresses: [
    {
      id: 'Main Location',
      country: 'US',
      zip: '92093',
      state: 'CA',
      city: 'La Jolla',
      street: '9500 Gilman Drive'
    }
  ],
  line_items: [
    {
      id: '1',
      quantity: 1,
      product_tax_code: '20010',
      unit_price: 15,
      discount: 0
    }
  ]
}).then(res => {
  res.tax; // Tax object
  res.tax.amount_to_collect; // Amount to collect
});
fastdivision commented 6 years ago

@protzi Checking this out now, thanks for reporting the issue!

fastdivision commented 6 years ago

@protzi Please upgrade to v2.0.1. Should be fixed now. Specs didn't catch this issue, I'll make sure to get them updated right away.

protzi commented 6 years ago

@fastdivision thanks for such fast fix, could please inform also why its calculating only for same state, if destination state is diff then response like this

{
    "order_total_amount": 105,
    "shipping": 100,
    "taxable_amount": 0,
    "amount_to_collect": 0,
    "rate": 0,
    "has_nexus": false,
    "freight_taxable": true,
    "tax_source": null
}
fastdivision commented 6 years ago

@protzi In the US, you only need to collect sales tax in states where you have nexus. If the destination state isn't provided in the from_ or nexus_addresses[] params and we don't have the state on file as a nexus state in your TaxJar account, we'll return back 0%. Hope this helps!

exodmn commented 5 years ago

Hello @fastdivision, I seem to be running into the same ' Not Acceptable - shipping is missing' issue. I am using the sample request from the TaxJar developer site and I am connecting to the sandbox url 'https://api.sandbox.taxjar.com/v2/'. I am using the latest 3.0.2 version installed in Visual Studio using NuGet.

Any help would be greatly appreciated.

lamichhanesuresh commented 5 years ago

Sandbox works for me. But production doesn't work for me. I also tried POST request in the Postman and same error as the title of this post. I am not using taxjar api, rather doing a HTTP POST Request.

Request: https://api.taxjar.com/v2/taxes?to_zip=80038&to_city=Broomfield&to_state=CO&to_street=145%20Nickel%20St&to_country=US&amount=37.80&shipping=8.28&customer_id=1

Response: { "error": "Not Acceptable", "detail": "shipping is missing", "status": "406" }

Is there a fix for this? Please let me know, Thanks

ScottRudiger commented 5 years ago

Thanks for the report @lamichhanesuresh. If you pass the same params as JSON in Postman the request returns the appropriate response:

Screen Shot 2019-07-30 at 9 54 21 AM

I see the same error when making a request with query params, which could be more descriptive of the problem. We'll take note of it!

lamichhanesuresh commented 5 years ago

Thanks @ScottRudiger . I modified my request to be json and it worked like a charm.