download-customer-invoice
Method: GET
Path: /orders/invoices/{invoice_number}/download
Tags: Orders
Summary
Download an issued invoice
Description
Returns only a Commerce Engine-issued invoice belonging to the current shopper and store. Seller and external invoices return 404. Reads an already issued document and never issues one.
Storefront SDK Usage
SDK Method: sdk.order.downloadInvoice()
Example:
typescript
const { data, error } = await sdk.order.downloadInvoice({
invoice_number: "INV/2024-25/000123"
});
if (error) {
console.error("Failed to download invoice:", error.message);
} else {
const url = URL.createObjectURL(data);
window.open(url);
}TypeScript Definition
typescript
"download-customer-invoice": {
parameters: {
query?: {
/** @description Include the invoice page layout. */
with_layout?: boolean;
};
header?: never;
path: {
/** @description The complete number exactly as issued, including slashes. Percent-encode slashes when constructing the URL. */
invoice_number: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Retained CE-issued invoice PDF */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/pdf": string;
};
};
403: components["responses"]["Forbidden"];
/** @description Document or order not found, or belongs to another shopper or store. */
404: {
headers: {
[name: string]: unknown;
};
content?: never;
};
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Parameters
- invoice_number (path): The complete number exactly as issued, including slashes. Percent-encode slashes when constructing the URL.
- with_layout (query): Include the invoice page layout.
Responses
200
Retained CE-issued invoice PDF
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
404
Document or order not found, or belongs to another shopper or store.
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
json
{
"tags": [
"Orders"
],
"operationId": "download-customer-invoice",
"summary": "Download an issued invoice",
"description": "Returns only a Commerce Engine-issued invoice belonging to the current shopper and store. Seller and external invoices return 404. Reads an already issued document and never issues one.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/download-customer-invoice",
"description": "API reference for the download-customer-invoice operation"
},
"parameters": [
{
"name": "invoice_number",
"in": "path",
"description": "The complete number exactly as issued, including slashes. Percent-encode slashes when constructing the URL.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "with_layout",
"in": "query",
"description": "Include the invoice page layout.",
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Retained CE-issued invoice PDF",
"content": {
"application/pdf": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"description": "Document or order not found, or belongs to another shopper or store."
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "orders",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "downloadCustomerInvoice"
}Auto-generated from OpenAPI spec and TypeScript definitions