create_invoice
STEP 1 of the MISA meInvoice flow: create a Vietnamese e-invoice (hóa đơn điện tử) draft on MISA — the POST /itg/invoicepublishing/createinvoice call. You supply seller, buyer and line items; this server computes the Vietnamese VAT (thuế GTGT) math locally in VND (integer đồng — no decimals) and forwards the payload. MISA returns a transaction_id, ref_id and invoice_data (an UNSIGNED invoice XML). This server does NOT sign: you then sign invoice_data MERCHANT-SIDE with your own digital signature / USB Token (chữ ký số) using the MISA local signing service, and pass the signed XML to publish_invoice (STEP 3). VAT rates: 10 (standard), 8 (temporary reduced), 5 (essentials), 0 (exports). Set withCode=true if you issue invoices WITH a tax-authority code (hóa đơn có mã); default false (không mã). Result accepted=true when MISA created the draft with no per-document error (check error_code). Required credential headers (set once in your MCP client, per-request, never stored): x-meinvoice-token (your MISA meInvoice access token) + x-meinvoice-taxcode (your company tax code / MST, sent as CompanyTaxCode). Optional header x-meinvoice-env: test (default = sandbox testapi.meinvoice.vn, no fiscal effect) | prod (production api.meinvoice.vn, real fiscal effect). Optional owner-policy headers x-agentpay-max-amount / x-agentpay-approval-above / x-agentpay-allowed-tools. All amounts are in VND (đồng, whole numbers — no decimals).
Parameters12
| seller | object | required | The seller (người bán) = your company. Requires legalName + taxCode. |
| buyer | object | optional | The buyer (người mua). Use legalName+taxCode for a company (B2B) or fullName for an individual consumer. |
| lines | array | required | Invoice line items. Each: { name, unit?, quantity, unitPrice, taxRate? }. taxRate is a VAT percentage (10 default / 8 / 5 / 0). unitPrice is in whole VND. |
| invSeries | string | required | Invoice series / ký hiệu (e.g. "1C25MYT") — assigned when you register the invoice template with the tax authority. REQUIRED. |
| refId | string | optional | Your own reference id for this invoice (RefID). Optional — a UUID is generated if omitted. Reusing a RefID triggers InvoiceDuplicated. |
| invoiceName | string | optional | Invoice type name, default "Hóa đơn giá trị gia tăng" (VAT invoice). |
| invDate | string | optional | Invoice date (ngày hóa đơn), ISO datetime. Default: now. |
| currencyCode | string | optional | Currency, default VND. VND is a 0-decimal currency; non-VND requires exchangeRate. |
| exchangeRate | number | optional | Exchange rate to VND (default 1 for VND). |
| paymentMethodName | string | optional | Payment method, default "TM/CK" (cash/bank transfer). |
| amountInWords | string | optional | Optional total amount spelled out in Vietnamese (số tiền bằng chữ). |
| withCode | boolean | optional | true = invoice WITH tax-authority code (có mã, uses /code/itg path); false (default) = without code (không mã). |
Raw schema
{
"type": "object",
"properties": {
"seller": {
"type": "object",
"description": "The seller (người bán) = your company. Requires legalName + taxCode.",
"properties": {
"legalName": {
"type": "string",
"description": "Seller organization legal name (tên đơn vị). Required for the seller; for the buyer, use legalName for a company or fullName for an individual."
},
"fullName": {
"type": "string",
"description": "Seller individual full name (họ tên người mua) — use for a personal/consumer buyer instead of legalName."
},
"taxCode": {
"type": "string",
"description": "Seller tax code / MST (mã số thuế). Required for the seller; for a B2B buyer include it, omit for an individual consumer."
},
"address": {
"type": "string",
"description": "Seller address (địa chỉ)."
},
"email": {
"type": "string",
"description": "Seller email (used for e-invoice delivery)."
},
"phone": {
"type": "string",
"description": "Seller phone number."
},
"bankAccount": {
"type": "string",
"description": "Seller bank account number (optional)."
},
"bankName": {
"type": "string",
"description": "Seller bank name (optional)."
}
},
"required": [
"legalName",
"taxCode"
]
},
"buyer": {
"type": "object",
"description": "The buyer (người mua). Use legalName+taxCode for a company (B2B) or fullName for an individual consumer.",
"properties": {
"legalName": {
"type": "string",
"description": "Buyer organization legal name (tên đơn vị). Required for the seller; for the buyer, use legalName for a company or fullName for an individual."
},
"fullName": {
"type": "string",
"description": "Buyer individual full name (họ tên người mua) — use for a personal/consumer buyer instead of legalName."
},
"taxCode": {
"type": "string",
"description": "Buyer tax code / MST (mã số thuế). Required for the seller; for a B2B buyer include it, omit for an individual consumer."
},
"address": {
"type": "string",
"description": "Buyer address (địa chỉ)."
},
"email": {
"type": "string",
"description": "Buyer email (used for e-invoice delivery)."
},
"phone": {
"type": "string",
"description": "Buyer phone number."
},
"bankAccount": {
"type": "string",
"description": "Buyer bank account number (optional)."
},
"bankName": {
"type": "string",
"description": "Buyer bank name (optional)."
}
}
},
"lines": {
"type": "array",
"description": "Invoice line items. Each: { name, unit?, quantity, unitPrice, taxRate? }. taxRate is a VAT percentage (10 default / 8 / 5 / 0). unitPrice is in whole VND.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Goods/service name (tên hàng hóa, dịch vụ)."
},
"unit": {
"type": "string",
"description": "Unit of measure (đơn vị tính), e.g. \"Cái\", \"Giờ\", \"Kg\"."
},
"quantity": {
"type": "number",
"description": "Quantity (số lượng)."
},
"unitPrice": {
"type": "number",
"description": "Unit price in VND (đơn giá), whole number."
},
"taxRate": {
"type": "number",
"description": "VAT rate percent: 10 (default, standard), 8 (reduced), 5, or 0."
}
},
"required": [
"name",
"quantity",
"unitPrice"
]
}
},
"invSeries": {
"type": "string",
"description": "Invoice series / ký hiệu (e.g. \"1C25MYT\") — assigned when you register the invoice template with the tax authority. REQUIRED."
},
"refId": {
"type": "string",
"description": "Your own reference id for this invoice (RefID). Optional — a UUID is generated if omitted. Reusing a RefID triggers InvoiceDuplicated."
},
"invoiceName": {
"type": "string",
"description": "Invoice type name, default \"Hóa đơn giá trị gia tăng\" (VAT invoice)."
},
"invDate": {
"type": "string",
"description": "Invoice date (ngày hóa đơn), ISO datetime. Default: now."
},
"currencyCode": {
"type": "string",
"description": "Currency, default VND. VND is a 0-decimal currency; non-VND requires exchangeRate."
},
"exchangeRate": {
"type": "number",
"description": "Exchange rate to VND (default 1 for VND)."
},
"paymentMethodName": {
"type": "string",
"description": "Payment method, default \"TM/CK\" (cash/bank transfer)."
},
"amountInWords": {
"type": "string",
"description": "Optional total amount spelled out in Vietnamese (số tiền bằng chữ)."
},
"withCode": {
"type": "boolean",
"description": "true = invoice WITH tax-authority code (có mã, uses /code/itg path); false (default) = without code (không mã)."
}
},
"required": [
"seller",
"lines",
"invSeries"
]
}