Shopify Calc 230321

Shopify Calc 230321
Operations
POST /#{config_url}
POST-config_url
POST /#{config_url}

Path variables

config_url
string required

The tax_calculation url defined using the Shopify cart_line

Request headers

X-Shopify-Shop-Domain
string required

The permanent domain of the merchant’s shop. Can be used to identify which shop is initiating the tax calculation.

X-Shopify-Request-Id
string required

The unique request ID used to track specific requests for troubleshooting purposes.

X-Shopify-Hmac-SHA256
string required

Token that is generated using HMAC algorithm with a SHA-256 hash of the request body encrypted with the secret of the app.

Request body

application/json
Examples
{
    "idempotent_key": "bbf8e3a2485c1a07c5c964f59e651eb0",
    "request": {
        "datetime_created_utc": "2023-02-21T14:38:12.000Z",
        "tax_included": true
    },
    "cart": {
        "buyer_identity": {
            "customer": {
                "id": "gid://Shopify/Customer/1234"
            },
            "purchasing_company": {
                "company": {
                    "id": "gid://Shopify/Company/1",
                    "vat_number": "ATU99999999"
                }
            },
            "tax_exempt": true
        },
        "billing_address": {
            "address1": "620 King St W",
            "address2": "Unit 5",
            "city": "Toronto",
            "province": "Ontario",
            "province_code": "ON",
            "country": "Canada",
            "country_code": "CA",
            "zip": "M5V1M7"
        },
        "delivery_groups": [
            {
                "id": "56H1FGg6d16DFSD16gfdg",
                "selected_delivery_method": {
                    "subtotal_amount": {
                        "amount": "12.5",
                        "currency_code": "USD"
                    },
                    "total_amount": {
                        "amount": "12.5",
                        "currency_code": "USD"
                    },
                    "delivery_method_type": "SHIPPING"
                },
                "origin_address": {
                    "address1": "620 King St W",
                    "address2": "Unit 5",
                    "city": "Toronto",
                    "province": "Ontario",
                    "province_code": "ON",
                    "country": "Canada",
                    "country_code": "CA",
                    "zip": "M5V1M7"
                },
                "delivery_address": {
                    "address1": "620 King St W",
                    "address2": "Unit 5",
                    "city": "Toronto",
                    "province": "Ontario",
                    "province_code": "ON",
                    "country": "Canada",
                    "country_code": "CA",
                    "zip": "M5V1M7"
                },
                "cart_lines": [
                    {
                        "id": "gid://shopify/LineItem/8BLFxjEHP5PkA1kNsb6iRKX9",
                        "merchandise": {
                            "id": "gid://Shopify/ProductVariant/1",
                            "type": "PRODUCT_VARIANT",
                            "sku": "XYZ12345",
                            "product": {
                                "id": "gid://Shopify/Product/2",
                                "handle": "crazy-pants",
                                "is_gift_card": true,
                                "metafields": [
                                    {
                                        "name": "tax_code",
                                        "value": ""
                                    }
                                ]
                            },
                            "requires_shipping": true,
                            "weight": 12.5,
                            "weight_unit": "GRAMS",
                            "tax_exempt": true,
                            "metafields": [
                                {
                                    "name": "tax_code",
                                    "value": 1
                                }
                            ]
                        },
                        "quantity": 5,
                        "cost": {
                            "amount_per_quantity": {
                                "amount": "12.5",
                                "currency_code": "USD"
                            },
                            "subtotal_amount": {
                                "amount": "12.5",
                                "currency_code": "USD"
                            },
                            "total_amount": {
                                "amount": "12.5",
                                "currency_code": "USD"
                            }
                        }
                    }
                ]
            }
        ]
    }
}

Responses

200 200

OK

Body
application/json
Examples
{
    "idempotent_key": "bbf8e3a2485c1a07c5c964f59e651eb0",
    "currency": "USD",
    "delivery_group_taxes": [
        {
            "id": "56H1FGg6d16DFSD16gfdg",
            "tax_lines": [
                {
                    "line_id": 5487357024222,
                    "tax_id": 897956,
                    "calculated_tax": "12.5",
                    "calculated_tax_refundable": "12.5",
                    "amount_exempt": "12.5",
                    "amount_taxable": "12.5",
                    "amount_non_taxable": "12.5"
                }
            ]
        }
    ],
    "taxes": [
        {
            "id": 897956,
            "title": "Canada GST",
            "rate": {
                "type": "EXCISE_TAX",
                "structure": "MEASUREMENT_BASED",
                "amount": "12.5"
            },
            "source": {
                "tax_registration": {
                    "code": "US-NY",
                    "registration_number": "1234"
                },
                "tax_authority": {
                    "code": "US-NY"
                },
                "tax_jurisdiction": {
                    "type": "CITY",
                    "name": "New York City",
                    "reporting_code": "12345"
                },
                "reporting_code": "12345"
            }
        }
    ],
    "errors": [
        {
            "code": "MALFORMED_ADDRESS",
            "message": "Address is not real"
        }
    ]
}
Type Definitions
request_body
Object
idempotent_key
string required

Unique identifier for the tax calculation attempt. It can be assumed that requests with a given ID are identical to previously received requests with the same ID

Example:
bbf8e3a2485c1a07c5c964f59e651eb0
request
request required
cart
cart required
request
Object
datetime_created_utc
string ISO_8601
Example:
2023-02-21T14:38:12.000Z
tax_included
boolean
Example:
false
cart
Object
buyer_identity
billing_address
delivery_groups
Array of cart_delivery_group required
cart_delivery_group
Object
id
string required
Example:
56H1FGg6d16DFSD16gfdg
selected_delivery_method
origin_address
delivery_address
cart_lines
Array of cart_line required
cart_delivery_option
Object
subtotal_amount
money required
total_amount
money required
delivery_method_type
delivery_method required
cart_line
Object
id
string required
Example:
gid://shopify/LineItem/8BLFxjEHP5PkA1kNsb6iRKX9
merchandise
One of required
quantity
integer required
Min: 1
Example:
5
cost
cart_line_cost required
cart_line_cost
Object
amount_per_quantity
money required
subtotal_amount
money required
total_amount
money required
custom_product
Object
title
string
Example:
Wooden Bowl (Custom)
is_gift_card
boolean required
Example:
false
requires_shipping
boolean
Example:
true
weight
number
Example:
12.5
weight_unit
tax_exempt
boolean required
Example:
false
product_variant
Object
id
string required
Example:
gid://Shopify/ProductVariant/1
sku
string
Example:
XYZ12345
product
product required
requires_shipping
boolean required
Example:
true
weight
number
Example:
12.5
weight_unit
tax_exempt
boolean required
Example:
false
metafields
Array of generic_property required
product
Object
id
string required
Example:
gid://Shopify/Product/2
handle
string required
Example:
crazy-pants
is_gift_card
boolean required
Example:
false
metafields
Array of generic_property required
generic_property
Object
name
string required
Example:
tax_code
value
Any of
string
number
boolean
weight_unit
string
Enumeration:
GRAMS
KILOGRAMS
OUNCES
POUNDS
Example:
GRAMS
buyer_identity
Object
customer
purchasing_company
tax_exempt
boolean required
customer
Object
id
string required
Example:
gid://Shopify/Customer/1234
purchasing_company
Object
company
Object required
id
string required
Example:
gid://Shopify/Company/1
vat_number
string
Example:
ATU99999999
mailing_address
Object
address1
string
Example:
620 King St W
address2
string
Example:
Unit 5
city
string
Example:
Toronto
province
string
Example:
Ontario
province_code
string
Min length: 2
Max length: 3
Example:
ON
country
string required
Example:
Canada
country_code
string required
Min length: 2
Max length: 3
Example:
CA
zip
string
Example:
M5V1M7
money
Object
amount
currency_code
string
Min length: 3
Max length: 3
Example:
USD
response
Object
idempotent_key
string
Example:
bbf8e3a2485c1a07c5c964f59e651eb0
currency
string required
Example:
USD
delivery_group_taxes
Array
Object
id
string required
Example:
56H1FGg6d16DFSD16gfdg
tax_lines
Array of tax_line required
taxes
Array of tax
errors
Array of error
error
Object
code
string
Enumeration:
MALFORMED_ADDRESS
BAD_DATA
MALFORMED_PAYLOAD
Example:
MALFORMED_ADDRESS
message
string
Example:
Address is not real
tax_line
Object
line_id
string required
Example:
5487357024222
tax_id
string required
Example:
897956
calculated_tax
decimal required
calculated_tax_refundable
decimal required
amount_exempt
decimal required
amount_taxable
decimal required
amount_non_taxable
decimal required
tax
Object
id
string required
Example:
897956
title
string required
Example:
Canada GST
rate
tax_rate required
source
tax_line_source required
decimal
string
Min length: 1
Pattern: ^\d+(\.\d+)?$
Example:
12.5
tax_rate
Object
type
string required
Enumeration:
USE_TAX
SALES_TAX
EXCISE_TAX
FEE
UNKNOWN
structure
string required
Enumeration:
STANDARD
FLAT
QUANTITY_BASED
MEASUREMENT_BASED
amount
decimal required
tax_line_source
Object
tax_registration
Object required
code
string required
Example:
US-NY
registration_number
string required
Example:
1234
tax_authority
Object required
code
string required
Example:
US-NY
tax_jurisdiction
reporting_code
string
Example:
12345
delivery_method
string
Enumeration:
LOCAL
NONE
PICKUP_POINT
RETAIL
SHIPPING
SHIPPING_AND_HANDLING
Example:
SHIPPING
merchandise_type
string
Enumeration:
PRODUCT_VARIANT
CUSTOM_PRODUCT
Example:
PRODUCT_VARIANT
tax_jurisdiction
Object
type
name
string required
Example:
New York City
reporting_code
string
Example:
12345
tax_jurisdiction_type
string
Enumeration:
APO
BOROUGH
CITY
COUNTRY
COUNTY
DISTRICT
FPO
LOCAL_IMPROVEMENT_DISTRICT
PARISH
PROVINCE
SPECIAL_PURPOSE_DISTRICT
STATE
TERRIROTY
TOWNSHIP
TRANSIT_DISTRICT
TRADE_BLOCK
Example:
CITY