I am receiving an order from the Shopify web-hook orders/create and need to store the price and tax applicable for that order. I see some settings in the Shopify preferences that allow me to set a sales tax per delivery destination. Also Shopify allows me to optionally charge taxes for shipping. I see the "taxes_included" property on the order (which I take to mean that the price listed is either net or gross). But it doesn't seem to specify if the shipping includes taxes. Is there a way I can get this information from the API?
Here is the data that I'm passed in the web-hook call. I can do further API calls to get the information if it is available, but can't find it all in the documentation.
I have found the countries API, documented here:
http://api.shopify.com/country.html
So I should be able to look up the correct tax percent for the line_items from the billing address province_code & country_code.
But I can't find anything telling me what tax should or shouldn't be charged on shipping lines.
It would be more convenient if the tax was actually provided in the data. It should also be more correct, since there is a chance (however small) that the tax rates are changed in between me getting the callback and making further requests for tax info. Is there a way to get Shopify to provide that information in the web-hook?
Also, I have so far failed to get an data in the tax_lines property in the data. Is there any hoop I need to jump through to get this?
An example of the data provided in the callback:
{"note":"",
"total_discounts":"0.00",
"cancel_reason":null,
"shipping_lines":
[{"code":"International Shipping",
"price":"25.00",
"source":"shopify",
"title":"International Shipping"}],
"landing_site_ref":null,
"discount_codes":[],
"currency":"CAD",
"buyer_accepts_marketing":true,
"customer":
{"last_order_name":null,
"note":null,
"last_name":"Test",
"state":"disabled",
"updated_at":"2012-11-20T08:05:07-05:00",
"last_order_id":null,
"orders_count":0,
"total_spent":"0.00",
"created_at":"2012-11-05T10:50:23-05:00",
"email":"[email protected]",
"first_name":"Test",
"accepts_marketing":true,
"id":101986160,
"tags":""},
"token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"note_attributes":[],
"gateway":"bogus",
"cancelled_at":null,
"name":"#1025",
"processing_method":"direct",
"updated_at":"2012-11-20T08:05:07-05:00",
"payment_details":
{"avs_result_code":null,
"credit_card_bin":"1",
"cvv_result_code":null,
"credit_card_number":"XXXX-XXXX-XXXX-1",
"credit_card_company":"Bogus"},
"total_price":"44.00",
"shipping_address":
{"country":"United States",
"last_name":"Test",
"longitude":"-88.1632",
"name":"Test Test",
"address1":"Test",
"province":"Alabama",
"address2":"",
"latitude":"30.3891",
"city":"Test",
"phone":"",
"province_code":"AL",
"first_name":"Test",
"country_code":"US",
"zip":"36523",
"company":"Test"},
"line_items":
[{"variant_id":240781369,
"quantity":1,
"name":"product with stock code and shopify stock value",
"properties":[],
"title":"product with stock code and shopify stock value",
"product_id":104741307,
"variant_inventory_management":"shopify",
"fulfillment_service":"manual",
"sku":"some-stock-code",
"variant_title":null,
"requires_shipping":true,
"price":"19.00",
"vendor":"Shopify",
"id":243081982,
"grams":0,
"fulfillment_status":null}],
"closed_at":null,
"billing_address":
{"country":"United States",
"last_name":"Test",
"longitude":"-88.1632",
"name":"Test Test",
"address1":"Test",
"province":"Alabama",
"address2":"",
"latitude":"30.3891",
"city":"Test",
"phone":"",
"province_code":"AL",
"first_name":"Test",
"country_code":"US",
"zip":"36523",
"company":"Test"},
"order_number":1025,
"total_line_items_price":"19.00",
"total_tax":"0.00",
"tax_lines":[],
"created_at":"2012-11-20T08:05:07-05:00",
"landing_site":"\/",
"fulfillments":[],
"total_price_usd":"44.14",
"financial_status":"authorized",
"email":"[email protected]",
"browser_ip":"1.2.3.4",
"total_weight":0,
"referring_site":"",
"client_details":
{"accept_language":"en-US,en;q=0.8",
"browser_ip":"1.2.3.4",
"session_hash":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"user_agent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.1 (KHTML, like Gecko) Chrome\/21.0.1180.89 Safari\/537.1"},
"subtotal_price":"19.00",
"number":25,
"taxes_included":false,
"id":148179898,
"cart_token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"fulfillment_status":null}