Tải hóa đơn/vé điển tử
sau khi phát hành
Mô tả chi tiết
1. Request
1.1 Url API
Method | URL API (BaseUrl lấy ở mô tả chung) |
---|---|
POST | <BaseUrl>/Download |
1.2 Header
Content-Type: application-json
Authorization: Bearer <token lấy ở api Lấy token Authorization>
1.3 Params
Tên | Bắt buộc | Mặc định | Diễn giải |
---|---|---|---|
invoiceWithCode | không | false | true/false : đánh dấu có phải HĐ/Vé thuộc loại có mã của CQT hay không |
invoiceCalcu | không | false | true/false : đánh dấu có phải hóa đơn máy tính tiền hay không |
downloadDataType | không | loại file muốn tải về(Xml,Pdf,Html,All) |
1.4 Body
list string mã tra cứu hóa đơn TransactionID
2 Response
{
"success": true,
"errorCode": null,
"descriptionErrorCode": null,
"errors": [],
"data": "list đối tượng DownloadInvoiceResult",
"customData": ""
}
3 Mô tả đối tượng InvoiceTemplateData
public class DownloadInvoiceResult
{
/// <summary>
/// TransactionID: mã tra cứu hóa đơn
/// </summary>
public string TransactionID { get; set; }
/// <summary>
/// Dữ liệu hóa đơn.
/// <para>Khi chọn tải hóa đơn dạng Xml thì dữ liệu trả về sẽ là nội dung Xml</para>
/// <para>Khi chọn tải hóa đơn dạng Pdf thì dữ liệu trả về sẽ là nội dung Pdf đã được chuyển đổi sang chuỗi base64</para>
/// <para>Khi chọn tải hóa đơn dạng All thì dữ liệu trả về sẽ là tệp Zip chứa cả tệp Xml và Pdf đã được chuyển đổi sang chuỗi base64</para>
/// <para>Khi chọn tải hóa đơn dạng Html thì dữ liệu trả về sẽ là nội dung định dạng HTML</para>
/// </summary>
public string data { get; set; }
/// <summary>
/// Mã lỗi
/// </summary>
public string ErrorCode { get; set; }
}
4. Ví dụ:
4.1 Request
URL: https://testapi.meinvoice.vn/api/integration/invoice/Download
HEADERS:
Content-Type: application-json
Authorization: Bearer <token lấy ở api Lấy token Authorization>
PARAMS:
invoiceWithCode:true
invoiceCalcu:false
downloadDataType:Pdf
BODY:
["L4CXU6X0W0","QWIGTN63E_"]
4.2 Response
{
"success": true,
"errorCode": null,
"descriptionErrorCode": null,
"errors": [],
"data": "https://www.test.meinvoice.vn/tra-cuu/downloadhandler.ashx?type=pdf&code=c014c26b-7c6a-4932-8c57-198ae73209fb&Viewer=1&SearchType=2",
"customData": ""
}
5 Tài liệu tham khảo (Curl Postman)
curl --location --request POST 'https://testapi.meinvoice.vn/api/integration/invoice/Download?invoiceWithCode=true&invoiceCalcu=false&downloadDataType=pdf' \
--header 'Authorization: Bearer <token lấy ở api Lấy token Authorization>' \
--header 'Content-Type: application/json' \
--data-raw '["L4CXU6X0W0","QWIGTN63E_"]'