我收到来自 Shopify 网络挂钩订单/创建的订单,需要存储适用于该订单的价格和税金。我在 Shopify 首选项中看到一些设置,这些设置允许我为每个送货目的地设置销售税。Shopify 还允许我选择收取运费税。我在订单上看到了“taxes_included”属性(我认为这意味着列出的价格是净价或毛价)。但似乎没有具体说明运费是否包含税费。有没有办法从 API 获取这些信息?
这是我在 web-hook 调用中传递的数据。如果信息可用,我可以进行进一步的 API 调用以获取信息,但无法在文档中找到所有信息。
我找到了国家 API,记录在这里:
http://api.shopify.com/country.html
所以我应该能够从帐单地址 Province_code 和 country_code 中查找 line_items 的正确税率。
但是我找不到任何东西告诉我应该或不应该对航运公司征收什么税。
如果数据中确实提供了税收,那将更方便。它也应该更正确,因为在我收到回调和进一步请求税务信息之间,税率有可能(无论多么小)发生变化。有没有办法让 Shopify 在 web-hook 中提供该信息?
另外,到目前为止,我还未能在数据中的 tax_lines 属性中获取数据。我需要跳过任何箍来得到这个吗?
回调中提供的数据示例:
{"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":"test@example.com",
"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":"test@example.com",
"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}