# Japan VAT Export Exemption Validator (`aulvem/japan-vat-export-validator`) Actor

Validate Japan consumption-tax export-exemption transactions against 消費税法 第7条1項, 適格請求書 issuer-number checksums, and 7-year carrier-document retention rules. Catch missing customs declarations before the 税務署 audit does.

- **URL**: https://apify.com/aulvem/japan-vat-export-validator.md
- **Developed by:** [Aulvem](https://apify.com/aulvem) (community)
- **Categories:** Business, E-commerce
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Japan VAT Export Exemption Validator

Validate Japan consumption-tax (消費税) export-exemption transactions in seconds. Each transaction is checked against **消費税法 第7条1項**, **国税庁通達 11-7-4** (carrier-document requirements), and **適格請求書 issuer-number checksums** — the three things a 税務署 audit will actually look at.

Built for Japan-based merchants selling cross-border on Shopify, BASE, Stores, or custom storefronts, and for the tax accountants (税理士) who file their returns.

### What it validates

For every transaction in a single Apify run:

- **Shipping country**: Must not be JP for an `export` exemption claim
- **Carrier documents**: At least one customs export declaration (輸出許可通知書), EMS dispatch note (差出票), bill of lading, air waybill, or DHL/FedEx equivalent — and the right one for the transaction value bucket (¥200,000 / ¥2M / ¥3M thresholds)
- **Retention horizon**: 7-year document-retention rule (消費税法施行令 第50条)
- **Qualified-invoice issuer number** (適格請求書, T + 13 digits): ISO 7064 MOD 9 checksum validation
- **Evidence hash chain**: Optional RFC 3161 timestamp chain marker for audit defense

### When to use it

- **Year-end review**: Before filing your 消費税 return, batch-validate the year's export transactions
- **Pre-audit hardening**: When you receive a 税務調査 notice, run every export claim through the validator to surface gaps proactively
- **Onboarding 税理士**: Send your accountant a single Apify dataset URL instead of an Excel sheet — they can re-run validation as your data updates
- **CI / nightly check**: Schedule the Actor to re-validate the last 90 days of Shopify orders nightly via Apify Scheduler

### Input

```json
{
  "qualifiedInvoiceNumber": "T1000000000007",
  "transactions": [
    {
      "shopifyOrderName": "#1001",
      "shippingCountry": "US",
      "shippedAt": "2026-04-15",
      "amount": 100,
      "currency": "USD",
      "amountJpy": 15042,
      "exemptionReason": "export",
      "documents": ["customs_export_declaration", "ems_dispatch_note"],
      "retentionUntil": "2033-04-15",
      "evidenceDocsHashChain": "0ce5b547..."
    }
  ]
}
````

Field reference is in the **Input** tab. `qualifiedInvoiceNumber` is optional (omit if your business is below the ¥10M threshold and not registered).

### Output

One dataset row per transaction. Each row contains:

| Field | Type | Description |
|---|---|---|
| `shopifyOrderName` | string | Echoed back for matching |
| `ok` | boolean | Overall pass / fail |
| `errors` | string\[] | Reasons the transaction fails the regime |
| `warnings` | string\[] | Non-blocking issues (e.g. missing hash chain for audit defense) |
| `documentSetOk` | boolean | Carrier-document requirement satisfied? |
| `documentSetMissing` | string\[] | Which document types are missing |
| `issuerNumberValid` | boolean | null | T-number checksum result (null when no T-number supplied) |

### Pricing

- **Pay-Per-Result (PPE)**: $0.001 per transaction validated
- **Free tier**: First 5 runs/day per Apify account
- A typical 1,000-order year-end batch costs **$1.00**

No subscription, no minimum. You pay only for the transactions you actually validate.

### Legal context

This Actor implements rules from:

- 消費税法 第7条1項 (export exemption)
- 消費税法施行令 第50条 (7-year retention)
- 国税庁通達 11-7-4 (acceptable carrier documents per amount bucket)
- 適格請求書等保存方式 (invoice system, T-number ISO 7064 MOD 9 checksum)

Validation logic is unit-tested against the published 国税庁 guidance. **This Actor does not replace a 税理士** — it surfaces issues mechanically; final disposition is your accountant's call.

### Known limits

- 国税庁通達 11-7-4 carrier-document list is the **2026 version**; if 国税庁 issues updates, this Actor publishes a new version (see the **Versions** tab)
- Currency conversion (`amountJpy`) is your responsibility — supply it pre-converted (use the rate on `shippedAt` per 法人税基本通達 13の2-1-2)
- The Actor does **not** read your accounting system directly; supply the transactions as JSON

### Roadmap

- v0.2: Direct Shopify Admin API integration (supply `shop` + token, skip the JSON marshaling)
- v0.3: PDF parsing for evidence docs (auto-extract document types from your customs paperwork)
- v0.4: 帳簿 (general ledger) cross-check against 消費税 申告書

Maintained by **aulvem**. Bug reports / feature requests via the **Issues** tab on the Actor page.

***

### Developer notes

This Actor is part of a [shared-modules monorepo](https://aulvem.pages.dev). Validation logic lives in `@ws/jp-vat-validator` (30 unit tests). The Actor itself is thin glue between Apify SDK I/O and the library.

Local run (developers only):

```powershell
cd apps/apify-jp-vat-validator
pnpm tsx src/main.ts
```

Uses Apify SDK in local mode; expects an `INPUT.json` in the configured KV store. See <https://docs.apify.com/sdk/js/docs/guides/local-development>.

Deploy is handled via `apify-cli push` from the maintainer's environment — pre-push sanity checks live in [docs/apify-actor-sanity-check.md](../../docs/apify-actor-sanity-check.md).

# Actor input Schema

## `transactions` (type: `array`):

List of export transactions to validate. Each one is checked independently against 消費税法 第7条1項 + retention + carrier-document requirements.

## `qualifiedInvoiceNumber` (type: `string`):

Optional. When provided, the issuer number is also validated (適格請求書 checksum).

## Actor input object example

```json
{}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("aulvem/japan-vat-export-validator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("aulvem/japan-vat-export-validator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call aulvem/japan-vat-export-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=aulvem/japan-vat-export-validator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Japan VAT Export Exemption Validator",
        "description": "Validate Japan consumption-tax export-exemption transactions against 消費税法 第7条1項, 適格請求書 issuer-number checksums, and 7-year carrier-document retention rules. Catch missing customs declarations before the 税務署 audit does.",
        "version": "0.1",
        "x-build-id": "545g0cVTzD0fOU9f5"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/aulvem~japan-vat-export-validator/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-aulvem-japan-vat-export-validator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/aulvem~japan-vat-export-validator/runs": {
            "post": {
                "operationId": "runs-sync-aulvem-japan-vat-export-validator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/aulvem~japan-vat-export-validator/run-sync": {
            "post": {
                "operationId": "run-sync-aulvem-japan-vat-export-validator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "transactions"
                ],
                "properties": {
                    "transactions": {
                        "title": "Transactions",
                        "minItems": 1,
                        "type": "array",
                        "description": "List of export transactions to validate. Each one is checked independently against 消費税法 第7条1項 + retention + carrier-document requirements.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "shopifyOrderName": {
                                    "title": "Order name",
                                    "type": "string",
                                    "description": "Echoed back in output for matching (e.g. Shopify order #1001)."
                                },
                                "shippingCountry": {
                                    "title": "Shipping country (ISO 3166-1 alpha-2)",
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 2,
                                    "description": "Destination country code. Must not be JP for an export claim."
                                },
                                "shippedAt": {
                                    "title": "Shipped date (YYYY-MM-DD)",
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                                    "description": "Actual ship date; binds the 7-year retention horizon."
                                },
                                "amount": {
                                    "title": "Amount (original currency)",
                                    "type": "number",
                                    "description": "Transaction amount in the original currency."
                                },
                                "currency": {
                                    "title": "Currency code (ISO 4217)",
                                    "type": "string",
                                    "minLength": 3,
                                    "maxLength": 3,
                                    "description": "3-letter currency code, e.g. USD, EUR, JPY."
                                },
                                "amountJpy": {
                                    "title": "Amount in JPY",
                                    "type": "integer",
                                    "description": "Pre-converted to JPY at shipped-at FX rate per 法人税基本通達 13の2-1-2."
                                },
                                "exemptionReason": {
                                    "title": "Exemption reason",
                                    "type": "string",
                                    "enum": [
                                        "export",
                                        "service_to_nonresident",
                                        "international_transport",
                                        "other"
                                    ],
                                    "description": "The specific clause of 消費税法 第7条 invoked."
                                },
                                "documents": {
                                    "title": "Carrier / customs documents on hand",
                                    "type": "array",
                                    "description": "Allowed values: customs_export_declaration, ems_dispatch_note, international_mail_dispatch_note, bill_of_lading, air_waybill, dhl_e_shipping, fedex_air_waybill. At least one is required for amounts ≥ ¥200,000. Validation is enforced at runtime; invalid kinds surface as warnings in the output.",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "retentionUntil": {
                                    "title": "Retention horizon (YYYY-MM-DD)",
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                                    "description": "Date after which evidence may be discarded; must be shippedAt + 7 years."
                                },
                                "evidenceDocsHashChain": {
                                    "title": "RFC 3161 hash chain (optional)",
                                    "type": "string",
                                    "description": "Optional. SHA-256 of the evidence-doc bundle; supports timestamp-chain audit defense."
                                }
                            },
                            "required": [
                                "shopifyOrderName",
                                "shippingCountry",
                                "shippedAt",
                                "amount",
                                "currency",
                                "amountJpy",
                                "exemptionReason",
                                "documents",
                                "retentionUntil"
                            ]
                        }
                    },
                    "qualifiedInvoiceNumber": {
                        "title": "Qualified invoice issuer number (T+13 digits)",
                        "pattern": "^T\\d{13}$",
                        "type": "string",
                        "description": "Optional. When provided, the issuer number is also validated (適格請求書 checksum)."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
