Ký số bằng HSM (bất đồng bộ)
(SignType=3)
Mô tả
Đối với phương thức phát hành hóa đơn ký số HSM bất đồng bộ (sử dụng cho các đơn vị nhiều HĐ và nhiều điểm xuất HĐ một lần ) call API để truyền thông tin của hóa đơn lên server MISA, MISA sẽ thực hiện validate các thông tin cấu trúc của hóa đơn và trả về TransactionID trong response của API truyền lên, các hóa đơn được đưa vào hàng chờ để phát hành lần lượt, sau khi phát hành Client có thể call API để lấy về trạng thái và thoog tin đầy đủ của hóa đơn sau khi phát hành
1. Request
1.1 Url API
Method | URL API (BaseUrl lấy ở mô tả chung) |
---|---|
POST | <BaseUrl>(https://testapi.meinvoice.vn/api/integration/invoice) |
1.2 Header
Content-Type: application-json
Authorization: Bearer <token lấy ở api Lấy token Authorization>
1.3 Body
đôi tượng InvoiceParameter
{
"SignType": 3, (loại ký số HSM - bất đồng bộ)
"InvoiceData": <list đối tượng InvoiceData>
}
Mô tả đối tượng: InvoiceData
2 Response
{
"success": true/false <Trạng thái khi call API trả về>,
"errorCode": "<Mã lỗi nếu có>",
"descriptionErrorCode": "<mô tả mã lỗi nếu có>",
"createInvoiceResult": null,
"publishInvoiceResult": <List thông tin publishInvoiceResult>
}
Mô tả đối tượng: publishInvoiceResult
3 Ví dụ
3.1 Request
URL: https://testapi.meinvoice.vn/api/integration/invoice
HEADERS:
Content-Type: application-json
Authorization: Bearer <token lấy ở api Lấy token Authorization>
BODY:
{
"SignType": 3,
"InvoiceData": [
{
"RefID": "a91f0781-3177-46af-b9bb-f1b9ef767228",
"InvSeries": "1C24TQQ",
"InvDate": "2024-09-18",
"CurrencyCode": "VND",
"ExchangeRate": 1.0,
"PaymentMethodName": "TM/CK",
"BuyerLegalName": "Công ty cổ phần MISA",
"BuyerTaxCode": "0101243150",
"BuyerAddress": "Tầng 9 tòa nhà Technosoft, Duy Tân, Dịch Vọng Hậu, Cầu Giấy, Hà Nội",
"BuyerCode": "MS001",
"BuyerPhoneNumber": "0241 522 526",
"BuyerEmail": "contact@misa.com.vn",
"BuyerFullName": "Nguyễn Xuân Hoàng",
"BuyerBankAccount": "010124315087210",
"BuyerBankName": "Ngân hàng Việt Nam Thịnh Vượng",
"TotalSaleAmountOC":500000,
"TotalSaleAmount":500000,
"TotalDiscountAmountOC": 0,
"TotalDiscountAmount": 0,
"TotalAmountWithoutVATOC": 500000.0,
"TotalAmountWithoutVAT": 500000.0,
"TotalVATAmountOC": 50000.0,
"TotalVATAmount": 50000.0,
"TotalAmountOC": 550000.0,
"TotalAmountOC": 550000.0,
"TotalAmountInWords": "Năm trăm năm mươi nghìn đồng.",
"OriginalInvoiceDetail": [
{
"ItemType": 1,
"LineNumber": 1,
"SortOrder":1,
"ItemCode": "AOSM01",
"ItemName": "Áo sơ mi Nam 40",
"UnitName": "Chiếc",
"Quantity": 10.0,
"UnitPrice": 50000.0,
"DiscountRate": 0,
"DiscountAmountOC": 0,
"DiscountAmount": 0,
"AmountOC": 500000.0,
"Amount": 500000.0,
"AmountWithoutVATOC": 500000.0,
"AmountWithoutVAT": 500000.0,
"VATRateName": "10%",
"VATAmountOC":50000,
"VATAmount":50000
}
],
"TaxRateInfo": [
{
"VATRateName": "10%",
"AmountWithoutVATOC": 500000.0,
"VATAmountOC": 50000.0
}
],
"OptionUserDefined": {
"MainCurrency": "VND",
"AmountDecimalDigits": "0",
"AmountOCDecimalDigits": "0",
"UnitPriceOCDecimalDigits": "0",
"UnitPriceDecimalDigits": "0"
}
}
]
}
3.2 Response
{
"success": true,
"errorCode": null,
"descriptionErrorCode": null,
"createInvoiceResult": null,
"publishInvoiceResult": ""[{\"RefID\":\"1d69845f-6c33-01b7-127b-8ec6dda71b47\",\"TransactionID\":\"J6TLS702P_\",\"InvNo\":null,\"InvDate\":\"2023-06-05T00:00:00+07:00\",\"ErrorCode\":null}]""
}
4. Tài liệu tham khảo (Curl Postman)
curl --location 'https://testapi.meinvoice.vn/api/integration/invoice' \
--header 'Authorization: Bearer <token lấy ở api Lấy token Authorization>' \
--header 'Content-Type: application/json' \
--header 'Cookie: TS01df89db=010fb9740483c6e090a0168ad18f153b6543df0dc2ef8db082c5fdd03356731f4ab3170cb5f315fa0afca8615e2ead2e9f8602d6e8' \
--data-raw '{
"SignType": 3,
"InvoiceData": [
{
"RefID": "1f269f4c-08af-4665-b7b6-eb62581f583c",
"InvSeries": "1C24TAA",
"InvDate": "2024-09-25",
"CurrencyCode": "VND",
"ExchangeRate": 1.0,
"PaymentMethodName": "TM/CK",
"BuyerLegalName": "Công ty cổ phần MISA",
"BuyerTaxCode": "0101243150",
"BuyerAddress": "Tầng 9 tòa nhà Technosoft, Duy Tân, Dịch Vọng Hậu, Cầu Giấy, Hà Nội",
"BuyerCode": "MS001",
"BuyerPhoneNumber": "0241 522 526",
"BuyerEmail": "contact@misa.com.vn",
"BuyerFullName": "Nguyễn Xuân Hoàng",
"BuyerBankAccount": "010124315087210",
"BuyerBankName": "Ngân hàng Việt Nam Thịnh Vượng",
"TotalAmountWithoutVATOC": 5000000.0,
"TotalVATAmountOC": 500000.0,
"TotalDiscountAmountOC": 0,
"TotalAmountOC": 5500000.0,
"TotalAmountInWords": "Năm triệu năm trăm nghìn đồng.",
"OriginalInvoiceDetail": [
{
"ItemType": 1,
"LineNumber": 1,
"ItemCode": "AOSM01",
"ItemName": "Áo sơ mi Nam 40",
"UnitName": "Chiếc",
"Quantity": 10.0,
"UnitPrice": 500000.0,
"DiscountRate": 0,
"DiscountAmountOC": 0,
"AmountOC": 5000000.0,
"AmountWithoutVATOC": 5000000.0,
"VATRateName": "10%",
"VATAmountOC":500000.0,
"VATAmount":500000.0
}
],
"TaxRateInfo": [
{
"VATRateName": "10%",
"AmountWithoutVATOC": 5000000.0,
"VATAmountOC": 500000.0
}
],
"OptionUserDefined": {
"MainCurrency": "VND",
"AmountDecimalDigits": "0",
"AmountOCDecimalDigits": "0",
"UnitPriceOCDecimalDigits": "0",
"UnitPriceDecimalDigits": "0"
}
}
],
"PublishInvoiceData": null
}'