Create Electronic Invoice

The API to create an electronic invoice receives invoice data, digitally signs it, submits it to the tax authority, and returns a tracking code. Use this tracking code to check the invoice status.


View demo invoice

API Endpoint

POST
https://einvoice-api-sandbox.sepay.vn/v1/invoices/create

API Request

template_codestringrequired

Invoice template code (from account details API)

invoice_seriesstringrequired

Invoice series (from account details API)

issued_datestringrequired

Issue date (YYYY-MM-DD HH:mm:ss)

currencystringrequired

Currency

Default: VND
provider_account_idstringrequired

Provider account ID (UUID)

payment_methodenum

Payment method:

  • TM: Cash
  • CK: Bank transfer
  • TM/CK: Cash and bank transfer
  • KHAC: Other
is_draftboolean
  • true: Create as draft (requires issuing later, does not count towards quota)
  • false: Create and issue immediately
Default: false
buyerobjectrequired
itemsarray<object>required

List of goods/services

notesstring

Internal notes

API Response

Success Response (200)
{
  "success": true,
  "data": {
    "tracking_code": "084e179d-d95a-11f0-aef4-52c7e9b4f41b",
    "tracking_url": "https://einvoice-api-sandbox.sepay.vn/v1/invoices/create/check/084e179d-d95a-11f0-aef4-52c7e9b4f41b",
    "message": "Đã tạo yêu cầu xuất bán hóa đơn điện tử"
  }
}
successboolean
dataobject

Error Handling

400Bad Request

Missing or invalid required fields.

401Unauthorized

Missing or invalid Bearer token.

500Internal Server Error

System error while signing/submitting.

Tax Rate Information

Tax Rate Information
  • tax_rate is only required when issuing VAT invoices for companies (not required for sales invoices).
  • The tax_rate field inside items accepts the following values:
    • -2 (Non-taxable)
    • -1 (Not declared / not subject to VAT calculation)
    • 0 (0% VAT rate)
    • 5 (5% VAT rate)
    • 8 (8% VAT rate)
    • 10 (10% VAT rate)

Usage Notes

General Notes
  • To officially issue the invoice, send is_draft=false. To save as a draft for preview only, send is_draft=true (draft invoices will not count toward your e-invoice quota).
  • provider_account_id is provided from the e-invoice account list API
  • After successfully submitting the invoice request, use the endpoint provided in tracking_url to call the invoice status tracking API
Adding Notes to the Invoice Template
  • If you want to display a note on the invoice, add an item with line_type:4 to the items (array) using the format below:
{
  "line_number": 3,
  "line_type": 4,
  "item_name": "Free promotional goods (This is your note)"
}
How Promotions Affect the Invoice Total
  • When sending a promotion line with line_type = 2, the default value is 0 and it is not included in the invoice total.
  • If you want promotional items to be included in the total amount, you must provide a unit_price or other price-related fields (similar to line_type = 1) greater than 0.

Sample Code

>
>
>
>
>
curl --request POST \
--url https://einvoice-api-sandbox.sepay.vn/v1/invoices/create \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"template_code":"1","invoice_series":"C26TSE","issued_date":"2026-01-26 00:00:00","currency":"VND","provider_account_id":"0aea3134-da40-11f0-aef4-52c7e9b4f41b","payment_method":"TM","is_draft":false,"buyer":{"type":"personal","name":"Công ty TNHH ABC","legal_name":"CÔNG TY CỔ PHẦN ABC","tax_code":"0123456789","address":"123 Đường ABC, Quận 1, TP.HCM","email":"contact@abc.com","phone":"0901234567","buyer_code":"KH-001","national_id":"001234567890"},"items":[{"line_number":1,"line_type":1,"item_code":"SP001","item_name":"Sản phẩm A","unit":"cái","quantity":10,"unit_price":100000,"tax_rate":10,"discount_tax":10,"discount_amount":100000,"before_discount_and_tax_amount":4500000}],"notes":"Ghi chú nội bộ"}'

Sample Parameters for Different Invoice Types

Sales Invoice Sample
json
{
  "template_code": "2",
  "invoice_series": "C25HTV",
  "issued_date": "2025-12-11 08:00:00",
  "currency": "VND",
  "provider_account_id": "{{your-provider-account-id}}",
  "buyer": {
      "name": "ABC Company",
      "tax_code": "0101234567",
      "address": "123 Street A, District B, Hanoi",
      "email": "buyer@example.com",
      "phone": "0900000000",
      "buyer_code": "KH-001",
      "national_id": "001234567890"
  },
  "items": [
      {
          "line_number": 1,
          "line_type": 1,
          "item_code": "SP001",
          "item_name": "Product A",
          "unit": "pcs",
          "quantity": 1,
          "unit_price": 4500000
      }
  ],
  "notes": "Invoice note",
  "is_draft": true
}
Sales Invoice with Order-Level Discount
json
{
  "template_code": "2",
  "invoice_series": "C26TSP",
  "issued_date": "2026-01-26 00:00:00",
  "currency": "VND",
  "provider_account_id": "{{your-provider-account-id}}",
  "buyer": {
      "type": "personal",
      "name": "Buyer Name Demo",
      "legal_name": "ABC JOINT STOCK COMPANY",
      "tax_code": "0317887567",
      "address": "88 Anh Sao Street, Binh An Ward, District 9, Ho Chi Minh City, Vietnam",
      "email": "buyeremaildemo@gmail.com"
  },
  "items": [
      {
          "line_number": 1,
          "line_type": 1,
          "item_code": "SP001",
          "item_name": "Product A",
          "unit": "pcs",
          "quantity": 1,
          "unit_price": 4500000
      },
      {
          "line_number": 2,
          "line_type": 3,
          "item_name": "Trade discount",
          "before_discount_and_tax_amount": 4500000
      }
  ],
  "notes": "Invoice note",
  "is_draft": false
}
Sales Invoice with Item Discount (Percentage - discount_tax)
json
{
  "template_code": "2",
  "invoice_series": "C26TSP",
  "issued_date": "2026-01-26 00:00:00",
  "currency": "VND",
  "provider_account_id": "{{your-provider-account-id}}",
  "buyer": {
      "type": "personal",
      "name": "Buyer Name Demo",
      "legal_name": "ABC JOINT STOCK COMPANY",
      "tax_code": "0317887567",
      "address": "88 Anh Sao Street, Binh An Ward, District 9, Ho Chi Minh City, Vietnam",
      "email": "buyeremaildemo@gmail.com"
  },
  "items": [
      {
          "line_number": 1,
          "line_type": 1,
          "item_code": "SP001",
          "item_name": "Product A",
          "unit": "pcs",
          "quantity": 1,
          "unit_price": 4500000,
          "discount_tax": 2
      }
  ],
  "notes": "Invoice note",
  "is_draft": false
}
Sales Invoice with Item Discount (Fixed Amount - discount_amount)
json
{
  "template_code": "2",
  "invoice_series": "C26TSP",
  "issued_date": "2026-01-26 00:00:00",
  "currency": "VND",
  "provider_account_id": "{{your-provider-account-id}}",
  "buyer": {
      "type": "personal",
      "name": "Buyer Name Demo",
      "legal_name": "ABC JOINT STOCK COMPANY",
      "tax_code": "0317887567",
      "address": "88 Anh Sao Street, Binh An Ward, District 9, Ho Chi Minh City, Vietnam",
      "email": "buyeremaildemo@gmail.com"
  },
  "items": [
      {
          "line_number": 1,
          "line_type": 1,
          "item_code": "SP001",
          "item_name": "Product A",
          "unit": "pcs",
          "quantity": 1,
          "unit_price": 4500000,
          "discount_amount": 100000
      }
  ],
  "notes": "Invoice note",
  "is_draft": false
}
Sales Invoice with Promotion
json
{
  "template_code": "2",
  "invoice_series": "C25HTV",
  "issued_date": "2025-12-11 08:00:00",
  "currency": "VND",
  "provider_account_id": "{{your-provider-account-id}}",
  "buyer": {
      "name": "ABC Company",
      "tax_code": "0101234567",
      "address": "123 Street A, District B, Hanoi",
      "email": "buyer@example.com",
      "phone": "0900000000"
  },
  "items": [
      {
          "line_number": 1,
          "line_type": 1,
          "item_code": "SP001",
          "item_name": "Product A",
          "unit": "pcs",
          "quantity": 1,
          "unit_price": 4500000
      },
      {
          "line_number": 2,
          "line_type": 2,
          "item_code": "KM001",
          "item_name": "Promotional Item",
          "unit": "pcs",
          "quantity": 1,
          "unit_price": 0
      }
  ],
  "notes": "Invoice note",
  "is_draft": true
}
VAT Invoice Sample
json
{
  "template_code": "1",
  "invoice_series": "C26TSE",
  "issued_date": "2026-01-26 00:00:00",
  "currency": "VND",
  "provider_account_id": "{{your-provider-account-id}}",
  "buyer": {
      "type": "personal",
      "name": "Buyer Name Demo",
      "legal_name": "ABC JOINT STOCK COMPANY",
      "tax_code": "0317887567",
      "address": "88 Anh Sao Street, Binh An Ward, District 9, Ho Chi Minh City, Vietnam",
      "email": "buyeremaildemo@gmail.com"
  },
  "items": [
      {
          "line_number": 1,
          "line_type": 1,
          "item_code": "SP001",
          "item_name": "Product A",
          "unit": "pcs",
          "quantity": 1,
          "unit_price": 4500000,
          "tax_rate": 10
      }
  ],
  "notes": "Invoice note",
  "payment_method": "CK",
  "is_draft": false
}
VAT Invoice with Order-Level Discount
json
{
  "template_code": "1",
  "invoice_series": "C26TSE",
  "issued_date": "2026-01-26 00:00:00",
  "currency": "VND",
  "provider_account_id": "{{your-provider-account-id}}",
  "buyer": {
      "type": "personal",
      "name": "Buyer Name Demo",
      "legal_name": "ABC JOINT STOCK COMPANY",
      "tax_code": "0317887567",
      "address": "88 Anh Sao Street, Binh An Ward, District 9, Ho Chi Minh City, Vietnam",
      "email": "buyeremaildemo@gmail.com"
  },
  "items": [
      {
          "line_number": 1,
          "line_type": 1,
          "item_code": "SP001",
          "item_name": "Product A",
          "unit": "pcs",
          "quantity": 1,
          "unit_price": 4500000,
          "tax_rate": 10
      },
      {
          "line_number": 2,
          "line_type": 3,
          "item_name": "Trade discount",
          "tax_rate": 10,
          "before_discount_and_tax_amount": 100000
      }
  ],
  "notes": "Invoice note",
  "payment_method": "TM/CK",
  "is_draft": false
}
VAT Invoice with Item Discount (Percentage - discount_tax)
json
{
  "template_code": "1",
  "invoice_series": "C26TSE",
  "issued_date": "2026-01-26 00:00:00",
  "currency": "VND",
  "provider_account_id": "{{your-provider-account-id}}",
  "buyer": {
      "type": "personal",
      "name": "Buyer Name Demo",
      "legal_name": "ABC JOINT STOCK COMPANY",
      "tax_code": "0317887567",
      "address": "88 Anh Sao Street, Binh An Ward, District 9, Ho Chi Minh City, Vietnam",
      "email": "buyeremaildemo@gmail.com"
  },
  "items": [
      {
          "line_number": 1,
          "line_type": 1,
          "item_code": "SP001",
          "item_name": "Product A",
          "unit": "pcs",
          "quantity": 1,
          "unit_price": 4500000,
          "tax_rate": 10,
          "discount_tax": 10
      }
  ],
  "notes": "Invoice note",
  "payment_method": "CK",
  "is_draft": false
}
VAT Invoice with Item Discount (Fixed Amount - discount_amount)
json
{
  "template_code": "1",
  "invoice_series": "C26TSE",
  "issued_date": "2026-01-26 00:00:00",
  "currency": "VND",
  "provider_account_id": "{{your-provider-account-id}}",
  "buyer": {
      "type": "personal",
      "name": "Buyer Name Demo",
      "legal_name": "ABC JOINT STOCK COMPANY",
      "tax_code": "0317887567",
      "address": "88 Anh Sao Street, Binh An Ward, District 9, Ho Chi Minh City, Vietnam",
      "email": "buyeremaildemo@gmail.com"
  },
  "items": [
      {
          "line_number": 1,
          "line_type": 1,
          "item_code": "SP001",
          "item_name": "Product A",
          "unit": "pcs",
          "quantity": 1,
          "unit_price": 4500000,
          "tax_rate": 10,
          "discount_amount": 100000
      }
  ],
  "notes": "Invoice note",
  "payment_method": "KHAC",
  "is_draft": false
}

Next Steps

After successfully submitting the invoice creation request and receiving a tracking_code:

  1. Track Invoice Creation Status - Use the tracking_code to check the processing result (required)
After confirming successful status