Skip to main content

Tạo và phát hành hóa đơn

API này cho phép tạo ký phát hành hóa đơn trong 1 bước (HSM signing). Hóa đơn sẽ được phát hành chính thức ngay sau khi tạo thành công.

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

Tạo và ký phát hành hóa đơn trong 1 bước (HSM signing).

Header Request

HeaderBắt buộcMô tả
Content-Typeapplication/json
x-client-idMã định danh của đối tác do TINGEE cung cấp.
x-signatureChữ ký xác thực HMAC SHA512. Xem thêm tại Cách sinh chữ ký.
x-request-timestampThời gian gửi request (format: yyyyMMddHHmmssSSS, múi giờ UTC+7)

Body Parameter

Body giống hệt endpoint Tạo hóa đơn nháp (CreateInvoiceDto), bao gồm các trường thông tin hóa đơn, danh sách items[]taxRateSummaries[].

Xem chi tiết bảng tham số tại Tạo hóa đơn nháp — Body Parameter.

Ví dụ mã nguồn

curl --location --request POST 'https://uat-open-api.tingee.vn/v1/e-invoice/create-and-issue' \
--header 'x-signature: YOUR_SIGNATURE' \
--header 'x-request-timestamp: 20251209103911111' \
--header 'x-client-id: YOUR_CLIENT_ID' \
--header 'Content-Type: application/json' \
--data '{
"invoicePattern": "1",
"invoiceSeries": "C25TAB",
"invoiceCode": "INV-20251209-002",
"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"
}
]
}'

Response mẫu

{
"data": {
"invoiceCode": "INV-20251209-002",
"trackingCode": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"invoiceNumber": "00000123",
"reservationCode": "ABC123XYZ"
},
"success": true,
"error": null
}
TrườngKiểuMô tả
data.invoiceCodestringMã hóa đơn.
data.trackingCodestringMã theo dõi (transactionUuid / magiaodich).
data.invoiceNumberstringSố hóa đơn chính thức (sau khi ký).
data.reservationCodestringMã bí mật — chỉ có ở SInvoice.
successbooleanTrạng thái xử lý (true = Thành công).
errorstringMã lỗi (nếu có), null nếu thành công.

Mã lỗi thường gặp

CodeMô tảHướng xử lý
90Sai format timestampKiểm tra format yyyyMMddHHmmssSSS.
91Request quá hạnKiểm tra thời gian gửi request.
97Sai chữ kýKiểm tra lại Secret Key và logic tạo Signature.
OthersLỗi khácXem Danh sách mã lỗi.