# 5.Query Order Invoice

# Brief Description

  • Queries the payment or refund receipt for a specified Swifood order and returns it as PDF, TXT, or JSON.
  • This endpoint only retrieves invoice content. It does not increase the print count or mark the receipt as a reprint.

# HTTP Request Information

# Request URL

  • {domain}/open-api/order/invoice

# Request Method

  • POST

# Request Header

Parameter Name Required Type Description
Content-Type Yes string application/json

# Request Body Parameters

Parameter Name Required Type Length Limit Example Description
appId Yes string - 45eebd745dcf0b5f6d6f9fcde28cd9fe8116a892 App ID provided by Swifood
storeKey Yes string 100 CVIEIYUNHTS0 Store key provided by Swifood
param Yes string - - Business parameters encoded as a JSON string
sign Yes string - abcdef RSA signature of param. See API Signature Process

# Param Parameters

Parameter Name Required Type Example Description
orderNo Yes string TB202610120001 Swifood order number
printType Yes integer 2 Receipt type: 2 payment receipt, 6 refund receipt
format Yes integer 1 Output format: 1 PDF, 2 TXT, 3 JSON

# Request Body Example

{
  "appId": "45eebd745dcf0b5f6d6f9fcde28cd9fe8116a892",
  "storeKey": "CVIEIYUNHTS0",
  "sign": "abcdef",
  "param": "{\"orderNo\":\"TB202610120001\",\"printType\":2,\"format\":3}"
}

Use the application's private key to create the RSA signature from the original param string. The param value sent in the request must exactly match the string used to generate sign.

# Successful Response

The response body and Content-Type depend on the requested format.

format Output Format Content-Type Response Body
1 PDF application/pdf A 58 mm-wide PDF stream. Content-Disposition is inline; filename="invoice-{orderNo}.pdf"
2 TXT text/plain;charset=UTF-8 A UTF-8 plain-text receipt with lines separated by newline characters
3 JSON application/json;charset=UTF-8 Structured receipt lines

# PDF Response Example

The response body contains PDF binary data and can be displayed or saved directly.

HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: inline; filename="invoice-TB202610120001.pdf"

%PDF-...

# TXT Response Example

SWIFOOD RESTAURANT
Invoice No: 000000000001
Order No: TB202610120001
...

# JSON Response Parameters

Parameter Name Type Description
orderContent array<string> Receipt content split into lines

# JSON Response Example

{
  "orderContent": [
    "SWIFOOD RESTAURANT",
    "Invoice No: 000000000001",
    "Order No: TB202610120001"
  ]
}

# Failed Response

If the order, requested receipt type, or receipt content cannot be found, the API returns an error response such as:

{
  "code": 21000,
  "message": "Invoice content not found.",
  "data": null
}

For other status codes, see API General Code.