Download Customer Invoice PDF
Download an invoice as a PDF file. The response is a binary PDF stream containing the full invoice document.
Endpoint
GET /api/shop/customer-invoices/{id}/pdfRequest Headers
| Header | Required | Description |
|---|---|---|
X-STOREFRONT-KEY | Yes | Your storefront API key |
Authorization | Yes | Bearer token (customer login required) |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Customer invoice ID |
Response (200 OK)
The response is a binary PDF file with the following headers:
| Header | Value |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename="invoice-{id}.pdf" |
PDF Contents
The PDF document includes:
- Store information and logo
- Billing and shipping addresses
- Invoice line items with SKU, quantity, price, and totals
- Financial summary (subtotal, tax, shipping, discount, grand total)
- Invoice number, order number, and date
cURL Example
bash
curl -X GET "http://localhost:8000/api/shop/customer-invoices/1/pdf" \
-H "X-STOREFRONT-KEY: pk_storefront_your_key_here" \
-H "Authorization: Bearer YOUR_CUSTOMER_TOKEN" \
-o invoice-001.pdfError Responses
Not Found (404):
json
{
"message": "Customer invoice with ID \"999\" not found."
}Unauthenticated (401):
json
{
"message": "Customer is not logged in."
}Notes
- Separate route: The
/pdfendpoint is a separate route (not an API Platform operation). - Rendering engine: Uses DomPDF for LTR locales and mPDF for RTL locales, supporting multilingual invoice rendering.
- Customer isolation: Customers can only download PDFs for invoices from their own orders.
- Binary response: The response body is a raw PDF binary stream, not JSON.
Use Cases
- Allow customers to download invoice PDFs for their records
- Provide printable invoice documents
- Support accounting and tax filing workflows

