Phát hành vé không mã, không ký số
(SignType=4)
Mô tả
Đối với vé điện tử không mã, mình có thể phát hành mà không cần ký số lên file XML, yêu cầu thiết lập ở mẫu mới thực hiện được API này
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": 4, (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": 4,
"InvoiceData": [
{
"RefID": "452b2976-51e3-495e-bf88-833b23d9e8df",
"InvSeries": "5K22GYY",
"InvoiceName": "Vé điện tử",
"InvDate": "2022-04-22T00:00:00+07:00",
"CurrencyCode": "VND",
"ExchangeRate": 1.0,
"PaymentMethodName": "TM/CK",
"Route":"HN-SG",
"From":"BX HN",
"Destination":"BX MD",
"Seat":"Ghế B01",
"VehicleNo":"BSX:29A-8888",
"DepatureDate":"2022-04-22T00:00:00",
"DepatureTime":"07:00",
"CustomField1":"loại xe",
"CustomField2":"số tài",
"TotalSaleAmount": 454545.454545,
"TotalSaleAmountOC": 454545.454545,
"TotalDiscountAmount": 0,
"TotalDiscountAmountOC": 0,
"TotalAmountWithoutVATOC": 454545.454545,
"TotalAmountWithoutVAT": 454545.454545,
"TotalVATAmountOC": 45454.54545454547,
"TotalVATAmount": 45454.54545454547,
"TotalAmountOC":500000.0,
"TotalAmount": 500000.0,
"TotalAmountInWords": "Một triệu năm trăm hai mươi hai nghìn ba trăm hai mươi ba phẩy mười hai đồng.",
"OriginalInvoiceDetail": [
{
"ItemType": 1,
"LineNumber": 1,
"SortOrder": 1,
"Quantity": 1.0,
"ItemName":"vé xe bắc nam",
"UnitPrice": 454545.454545,
"AmountWithoutVATOC":454545.454545,
"AmountOC":500000.0,
"Amount": 500000.0,
"VATRateName": "10%",
"VATAmountOC": 45454.54545454547,
"VATAmount": 45454.54545454547
}
],
"TaxRateInfo": [
{
"VATRateName": "10%",
"AmountWithoutVATOC": 454545.454545,
"VATAmountOC":45454.54545454547
}
],
"OptionUserDefined": {
"MainCurrency": "VND",
"AmountDecimalDigits": "0",
"AmountOCDecimalDigits": "0",
"UnitPriceOCDecimalDigits": "0",
"UnitPriceDecimalDigits": "0"
}
}
]
}
3.2 Response
{
"success": true,
"errorCode": null,
"descriptionErrorCode": null,
"createInvoiceResult": null,
"publishInvoiceResult": "[{\"RefID\":\"452b2976-51e3-495e-bf88-833b23d9e8df\",\"TransactionID\":\"DBCLT12Q06\",\"InvTemplateNo\":null,\"InvSeries\":null,\"InvNo\":\"00000001\",\"InvCode\":null,\"InvDate\":\"2024-09-26T00:00:00+07:00\",\"ErrorCode\":\"\",\"CustomData\":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: TS01166205=019ba1692d8b1da10fec9fb33723f1c85f2f135a8ecdd315875db25b25a7f2d42010f5e479050532d280aaef56d4373b3bf5f0a940; TS01df89db=010fb97404fd843fa04307891b9a3b9851e5ccf0973f19d4656988d22a15fddf252b488556666b887e36b9f0b7c4916583f7707484' \
--data-raw '{
"SignType": 2,
"InvoiceData": [
{
"RefID": "ab153611-cde0-441e-877a-3cbded15b7d1",
"InvSeries": "5K24GKA",
"InvDate": "2024-09-26",
"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
}'