Skip to main content

Create a draft invoice

This API lets you create a draft invoice (draft/preview) and returns the Base64 PDF file of the created invoice.

POST
URLhttps://open-api.tingee.vn/v1/e-invoice/create

Create a draft invoice (draft/preview) and return the Base64 PDF file.

Header Request​

HeaderRequiredDescription
Content-Type✓application/json
x-client-id✓Partner identifier issued by TINGEE.
x-signature✓HMAC SHA512 authentication signature. See How to generate the signature.
x-request-timestamp✓Time the request is sent (format: yyyyMMddHHmmssSSS, UTC+7)

Body Parameter​

FieldTypeRequiredDescription
merchantIdnumber✕Merchant ID.
(Required if you connect with a Master Merchant account).
accountIdnumber✕Account configuration ID (if empty, the default account is used).
invoicePatternstring✓Invoice template number (mẫu số). See Get invoice templates.
invoiceSeriesstring✓Invoice symbol (ký hiệu). See Get invoice templates.
invoiceCodestring✓Invoice code generated by the partner (unique key), used later to download the invoice / send email.
invoiceDatedate✓Invoice date (format: YYYY-MM-DD, e.g. 2025-12-09).
invoiceTypestring✕Invoice type (provider-specific).
buyerTaxCodestring✕Buyer's tax code.
buyerIdentitystring✕Buyer's identity document number (citizen ID card (CCCD) / passport / business registration certificate (GPKD) number).
The BKAV provider does not use this field yet.
buyerIdTypestring✕Document type of buyerIdentity: 1=citizen ID card (CCCD), 2=passport, 3=business registration certificate (GPKD). Other values are rejected.
Currently only sent to SInvoice; if you pass buyerIdentity without buyerIdType, it defaults to 1.
buyerNamestring✕Buyer name.
TINGEE does not require this field, but the provider (e.g. SInvoice) may reject the invoice if both buyerName and buyerLegalName are missing.
buyerLegalNamestring✕Buyer's company name.
buyerAddressstring✕Buyer address.
buyerPhonestring✕Buyer phone number.
buyerEmailstring✕Buyer email.
buyerBankAccountstring✕Buyer's bank account number.
buyerBankNamestring✕Buyer's bank name.
paymentMethodnumber✕Payment method: 1=cash (TM), 2=bank transfer (CK), 3=cash/bank transfer (TM/CK) (Default: 3).
paymentMethodNamestring✕Payment method name (generated by the system from paymentMethod if not passed).
currencystring✕Currency code (Default: VND).
exchangeRatestring✕Foreign currency exchange rate (Default: 1).
amountInWordsstring✕Amount in words (generated automatically if not passed).
notestring✕Invoice note.
itemsarray✓List of goods/services (see the items[] table below).
totalDiscountstring✕Total discount amount (calculated by the system if not passed).
totalBeforeTaxstring✕Total amount before tax (calculated by the system if not passed).
totalTaxstring✕Total tax amount (calculated by the system if not passed).
totalAfterTaxstring✕Total amount after tax (calculated by the system if not passed).
taxRateSummariesarray✕Tax rate summary (calculated by the system if not passed, see the table below).

items[] — Goods / service details​

FieldTypeRequiredDescription
itemCodestring✕Item code.
itemNamestring✓Goods / service name.
unitNamestring✕Unit of measure.
quantitystring✓Quantity.
unitPricestring✓Unit price.
discountstring✕Discount percentage (e.g. 10 = 10%).
discountAmountstring✕Discount amount (if not passed, the system calculates it from quantity × unitPrice × discount).
totalBeforeTaxstring✕Total amount before tax (calculated by the system if not passed).
taxRateCodestring✓Tax rate code: 0, 5, 8, 10, -1 (not subject to VAT, KCT), -2 (not required to declare and pay tax, KKKNT).
taxAmountstring✕Tax amount (calculated by the system if not passed).
totalAfterTaxstring✕Total amount after tax (calculated by the system if not passed).
itemTypenumber✕Line type (Default: 1): 1=goods, 2=promotion, 3=discount, 4=note, 5=service, 6=statement (bảng kê), 7=other fees.
Provider limitations: XCyber does not support 2, 6, 7; HiLo and MISA do not support 6, 7; BKAV does not support 6 (returns error 2038).
adjustmentTypenumber✕Increase/decrease adjustment (for adjustment invoices).

taxRateSummaries[] — Tax rate summary​

FieldTypeRequiredDescription
taxRateCodestring✓Tax rate code.
totalTaxableAmountstring✕Total taxable amount.
taxAmountstring✕Total tax amount.

Code samples​

curl --location --request POST 'https://open-api.tingee.vn/v1/e-invoice/create' \
--header 'accept: application/json' \
--header 'x-client-id: YOUR_CLIENT_ID' \
--header 'x-request-timestamp: 20240509154004003' \
--header 'x-signature: YOUR_SIGNATURE' \
--header 'Content-Type: application/json' \
--data '{
"invoicePattern": "1",
"invoiceSeries": "C25TAB",
"invoiceCode": "INV-20251209-001",
"invoiceDate": "2025-12-09",
"buyerName": "Nguyen Van A",
"buyerLegalName": "CONG TY TNHH ABC",
"buyerTaxCode": "0109876543",
"buyerAddress": "123 Nguyen Hue, Quan 1, TP.HCM",
"paymentMethod": 2,
"paymentMethodName": "Chuyển khoản",
"items": [
{
"itemName": "Dịch vụ thanh toán",
"unitName": "Gói",
"quantity": "1",
"unitPrice": "1000000",
"taxRateCode": "10"
}
]
}'

Sample Response​

{
"code": "00",
"message": "Success",
"data": {
"invoiceCode": "INV-20251209-001",
"pdfBase64": "JVBERi0xLjQKMSAwIG9iago8PA..."
}
}
FieldTypeDescription
codestringStatus code.
messagestringResult message.
data.invoiceCodestringInvoice code.
data.pdfBase64stringPDF file content in Base64.

Common error codes​

CodeDescriptionHow to handle
2032No default provider account is configuredCreate an account with isDefault = true via Create/Update account, or pass accountId.
1057No account found for accountIdCheck accountId with List accounts.
2038The provider does not support the item type (itemType)XCyber does not support itemType 2/6/7; HiLo and MISA do not support 6/7; BKAV does not support 6.
1095, 1096Master Merchant merchantId errorPass the merchantId of a sub-Merchant belonging to the Master Merchant calling the API.
90, 91, 92, 97Request authentication error (timestamp, client-id, signature)See System error codes.
OthersOther errorsSee Error codes.