# Marketplace settlement reader API

> Read Shopee, TikTok Shop and Lazada income / settlement exports (XLSX, CSV): fees, tax withheld by the platform (NĐ 117/2025), payout, bank reconciliation.

- Endpoint: `POST https://apibox.io.vn/v1/vn-marketplace-settlement`
- Category: Files
- HTML docs: https://apibox.io.vn/docs/vn-marketplace-settlement/ (Vietnamese: https://apibox.io.vn/vi/docs/vn-marketplace-settlement/)
- Online tool: https://apibox.io.vn/tools/vn-marketplace-settlement/
- Authentication: `Authorization: Bearer <API key>` or `X-API-Key: <API key>` (free key: https://apibox.io.vn/dashboard/#signup)

Upload one or more exports as `file`, `file2`… (XLSX or CSV; Shopee "Báo cáo thu nhập", TikTok Shop statements, Lazada transaction overview) or send `rows` as JSON. The platform and the columns are recognised from the header words in Vietnamese or English (the header row may be below a title block); Lazada's one-row-per-fee format is grouped by order. Columns that were not recognised are listed, and `column_map` (role → header text) overrides the detection when a platform changes its export.

Every order is normalised: product price, refunds, seller and platform discounts, shipping paid / charged / subsidised, fees (commission, service, payment, affiliate, other), VAT and PIT withheld by the platform, payout, the payout recomputed from the parts and the difference. Totals by month and quarter give the taxable revenue, fees, tax withheld and money received; issues flag payout mismatches, a withholding rate different from the 1% + 0.5% (goods), 5% + 2% (services) or 3% + 1.5% of NĐ 117/2025, and tax withheld on fully refunded orders.

`bank_receipts` matches payout batches (platform + settlement date) with bank receipts; `orders` lists shop orders not yet settled. `hkd_rows` are ready for /v1/vn-hkd-books. Platforms change their files without notice: check the recognised columns.

## Parameters

| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
| `file` | body | file | yes |  | Income / settlement export (XLSX or CSV); more files as file2, file3… (max 12). |
| `rows` | body | array | no |  | Or the export rows as JSON objects (export column names as keys). |
| `platform` | body | string | no |  | Force shopee, tiktok or lazada (default: detected). |
| `column_map` | body | object | no |  | Role → header text, e.g. {"payout": "Số tiền quyết toán"}. Roles: order_id, order_date, settled_date, gross, refund, seller_discount, platform_subsidy, shipping_buyer, shipping_actual, shipping_subsidy, fee_fixed, fee_service, fee_payment, fee_affiliate, fee_other, fee_total, vat, pit, payout, amount, fee_name, status. |
| `seller_type` | body | string | no | `household` | household, individual or enterprise (no withholding). |
| `tax_category` | body | string | no | `goods` | goods (1% + 0.5%), services (5% + 2%) or goods_services (3% + 1.5%). |
| `bank_receipts` | body | array | no |  | [{date, amount, reference}] to match payout batches. |
| `orders` | body | array | no |  | Shop order IDs to find orders not settled yet. |
| `tolerance` | body | number | no | `1000` | Tolerance in VND for the payout and bank checks. |

## Example request

```bash
curl -X POST "https://apibox.io.vn/v1/vn-marketplace-settlement" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "0=@./my-file"
```

## Example response

```json
{
  "files": [
    {
      "platform": "shopee",
      "format": "wide (one row per order)",
      "header_row": 3,
      "orders": 3,
      "unknown_columns": [
        "Mã yêu cầu hoàn tiền"
      ]
    }
  ],
  "totals": {
    "orders": 3,
    "gross": 1800000,
    "refund": 300000,
    "seller_discount": 20000,
    "revenue": 1480000,
    "fees": 292000,
    "vat_withheld": 14800,
    "pit_withheld": 7400,
    "payout": 1140800
  },
  "months": [
    {
      "month": "2026-10",
      "orders": 2,
      "gross": 800000,
      "refund": 300000,
      "seller_discount": 20000,
      "revenue": 480000,
      "fees": 92000,
      "vat_withheld": 4800,
      "pit_withheld": 2400,
      "payout": 355800
    }
  ],
  "tax": {
    "seller_type": "household",
    "category": "goods",
    "rates": {
      "vat_percent": 1,
      "pit_percent": 0.5
    },
    "withheld_total": 22200
  },
  "issue_count": 0,
  "reconciliation": {
    "matched": 1,
    "unmatched_batches": 2
  },
  "hkd_rows": [
    {
      "date": "2026-10-31",
      "doc_no": "SAN-2026-10",
      "description": "Doanh thu bán hàng qua sàn TMĐT tháng 10/2026",
      "type": "sale",
      "amount": 480000,
      "sector": "distribution",
      "payment": "bank"
    }
  ],
  "orders": [
    {
      "platform": "shopee",
      "file": "file",
      "row": 4,
      "order_id": "2610010ABC",
      "kind": "order",
      "order_date": "2026-10-01",
      "settled_date": "2026-10-06",
      "gross": 500000,
      "refund": 0,
      "seller_discount": 20000,
      "platform_subsidy": 0,
      "revenue": 480000,
      "shipping": {
        "buyer_paid": 30000,
        "actual": 30000,
        "subsidy": 0,
        "return": 0
      },
      "fees": {
        "fixed": 48000,
        "service": 20000,
        "payment": 24000,
        "affiliate": 0,
        "other": 0
      },
      "fee_total": 92000,
      "tax_withheld": {
        "vat": 4800,
        "pit": 2400,
        "total": 7200
      },
      "expected_tax": {
        "vat": 4800,
        "pit": 2400
      },
      "payout": 380800,
      "payout_computed": 380800,
      "payout_difference": 0,
      "status": null
    }
  ]
}
```

## Use cases

- Reconcile marketplace payouts with the bank account
- Sum the tax withheld by platforms to offset or reclaim it
- Build the revenue book of a household seller from platform reports
- Compare real fees per order across Shopee, TikTok Shop and Lazada

## FAQ

### Which files are supported?

Income / settlement exports of Shopee, TikTok Shop and Lazada as XLSX or CSV, in Vietnamese or English. When a column is not recognised it is listed under unknown_columns; send column_map to map it.

### How is the platform tax checked?

For household and individual sellers platforms withhold VAT and PIT on revenue (NĐ 117/2025/NĐ-CP from 1/7/2025): 1% + 0.5% for goods. The API compares what was withheld with that rate on the revenue after seller discounts and refunds.

### Can I get the withheld tax back?

Households with annual revenue up to 1 billion VND have no VAT / PIT due from 2026; the amount withheld is offset or refunded on request. Use the monthly totals as the basis.
