InvoiceState
Type: schema
Description
A sales invoice for a shipment, or for an order's digital items: one Commerce Engine generates (invoice_source default, invoice.* events) or one issued by the seller (seller, external_invoice.* events): by the seller, their ERP, or a seller store.
TypeScript Definition
typescript
InvoiceState: {{
invoice_number: string;
/** @description Invoice total: the invoice's own, or, when it has no totals of its own, computed from its lines (`subtotal` + `total_tax` + `shipping_amount` - `coupon_discount_amount`). */
grand_total: number;
/** @description The invoice number (same as `invoice_number`); the event's key. */
invoice_id: string;
/**
* @description `seller` for a seller invoice; `default` for one Commerce Engine generates.
* @enum {string}
*/
invoice_source: "seller" | "default";
/** Format: date */
invoice_date: string | null;
/** @description The order number (same as `order_number`). */
order_id: string;
order_number: string;
/** @description The shipment's reference number (same as `reference_number`); `MS:`-prefixed on a seller store's copy of a marketplace shipment. `null` for an invoice of an order's digital items, which have no shipment. */
shipment_id: string | null;
/** @description Present when the shipment belongs to a marketplace. */
marketplace_listing?: {
marketplace_id: string;
}[];
/** @description Commerce Engine's id for the invoice. */
invoice_record_id?: number;
/** @description Same as `invoice_record_id`. */
invoice_generation?: number;
/** @description `printed` by default; `cancelled` on `external_invoice.cancelled`. */
status?: string;
reference_number?: string | null;
warehouse_id?: string | null;
/** @description The shipment's items, with quantity and free quantity. */
shipment_items?: {
product_id: string;
variant_id: null | string;
quantity: number;
free_quantity: number;
}[];
/** @description The order's billing business name. */
billing_business_name?: string | null;
/** @description Item total before tax, from the invoice's own totals; not filled when it has none (`subtotal` always is). */
sub_total?: number;
/** @description Item total including tax. */
sub_total_including_tax?: number;
promotion_discount_amount?: number;
/** @description Discount on the invoice: its own, or, when it has no totals of its own, its lines' coupon and promotion discounts. */
coupon_discount_amount?: number;
/** @description Loyalty-point value redeemed against this invoice. */
loyalty_point_redeemed?: number;
shipping_amount?: number;
shipping_amount_including_tax?: number;
/** @description Supplier identity and address retained on the invoice; the supplier can be a seller or a store location. */
seller_details?: null | {
id?: string | null;
name?: string | null;
gstin?: string | null;
state?: string | null;
city?: string | null;
pincode?: string | null;
pinCode?: string | null;
address_line1?: string | null;
address_line2?: string | null;
addressLine1?: string | null;
addressLine2?: string | null;
pan?: string | null;
panNumber?: string | null;
tax_identification_number?: string | null;
cin?: string | null;
drugLicenseNumber?: string | null;
drug_license_number?: string | null;
trade_name?: string | null;
legal_name?: string | null;
website?: string | null;
country?: string | null;
};
/** @description GST e-invoice Invoice Reference Number. */
irn_number?: null | string;
/** @description GST e-invoice acknowledgement number. */
ack_number?: string | null;
/**
* Format: date-time
* @description GST e-invoice acknowledgement date.
*/
ack_date?: string | null;
/** @description GST e-invoice signed QR code. */
signed_qr_code?: string | null;
/** @description Gate-pass barcode from the seller's ERP. */
gatepass_barcode?: string | null;
/** @description Invoice lines: the SKU, quantities and price of each invoiced item. */
items?: {
sku: string;
order_item_id?: string;
/** @description Invoiced quantity. */
qty: string;
/** @description Batch number of the goods, from the seller's ERP. */
batch_no?: string | null;
/** @description Expiry of the batch, from the seller's ERP. */
expiry?: string | null;
/** @description Free (scheme) quantity on top of `qty`. */
free_qty?: string | null;
/** @description The line's name. */
item_name?: string | null;
listing_price?: number;
selling_price?: number;
selling_price_excluding_tax?: number;
tax_rate?: number;
tax_type?: string;
product_name?: string;
product_image_url?: string | null;
hsncode?: string | null;
coupon_discount_amount?: number;
promotion_discount_amount?: number;
/** @description Selling-price consideration for this invoiced quantity after allocated discounts; includes GST when the selling price includes GST. Use taxable_value for the GST base. */
amount?: number;
/** @description Accounting line subtotal before coupon and promotion deductions. */
subtotal?: number;
/** @description The GST base retained on the invoice. Earlier before-discount invoices can differ from net_value. Omitted when pricing_breakdown_available is false. */
taxable_value?: number;
/** @description GST on the taxable consideration. Omitted when pricing_breakdown_available is false. */
tax?: number;
/** @description GST apportioned across CGST, SGST, UTGST or IGST for the recorded place of supply. Omitted when the invoice's tax breakdown is unavailable; recorded invoice totals are retained. GST components do not apply to non-GST invoices. */
tax_components?: {
CGST?: number;
SGST?: number;
UTGST?: number;
IGST?: number;
};
/** @description Taxable consideration and GST at each rate applicable to this invoice line. Omitted when pricing_breakdown_available is false. */
tax_lines?: {
rate?: number | string;
taxable_value?: number | string;
tax?: number | string;
/** @description GST apportioned across CGST, SGST, UTGST or IGST for the recorded place of supply. Omitted when the invoice's tax breakdown is unavailable; recorded invoice totals are retained. GST components do not apply to non-GST invoices. */
tax_components?: {
CGST?: number;
SGST?: number;
UTGST?: number;
IGST?: number;
};
/** @description Units of this line taxed at this rate. A line's tax lines add up to its paid units. Omitted when an earlier invoice didn't record how its units split across rates. */
quantity?: string;
net_value?: number | string;
}[];
/** @description Retained monetary amounts used by this issued invoice. */
pricing_snapshot?: {
[key: string]: unknown;
} | null;
/** @description Whether the invoice line’s selling price includes GST. */
price_including_tax?: boolean;
/** @description Transaction value after the line’s allocated discounts, excluding GST. */
net_value?: number;
/** @description False when a retained invoice, including one issued by Commerce Engine, lacks the original place of supply or the line or charge particulars needed for reliable tax detail. When false, this item's taxable_value, tax_lines, tax and GST components are omitted. The invoice's recorded totals, including its grand total and total tax, are still returned. */
pricing_breakdown_available?: boolean;
}[];
created_at?: string;
modified_at?: string;
billing_address?: {
first_name: string;
last_name: null | string;
business_name: string | null;
phone: null | string;
country_code: null | string;
address_line1: null | string;
address_line2: string | null;
landmark: string | null;
pincode: null | string;
city: string;
state: null | string;
country: null | string;
gstin: string | null;
email: null | string;
is_email_verified: boolean;
is_phone_verified: boolean;
};
shipping_address?: {
first_name: string;
last_name: null | string;
business_name: string | null;
phone: null | string;
country_code: null | string;
address_line1: null | string;
address_line2: string | null;
landmark: string | null;
pincode: null | string;
city: string;
state: null | string;
country: null | string;
gstin: string | null;
email: null | string;
is_email_verified: boolean;
is_phone_verified: boolean;
};
coupon_code?: null | string;
/** @description GST totals grouped by rate. Omitted when pricing_breakdown_available is false because the retained invoice's place of supply, line particulars or charge particulars are unavailable. Recorded totals, including the grand total and total tax, are still returned. */
tax_summary?: {
tax_rate?: number;
taxable_value?: number;
tax?: number;
cgst?: number;
sgst?: number;
utgst?: number;
igst?: number;
}[];
/** @description Item total before tax: `sub_total`, or, when the invoice has no totals of its own, the sum of its lines' `subtotal`. */
subtotal?: number;
/** @description Total tax: `sub_total_including_tax` - `sub_total`, or, when the invoice has no totals of its own, the tax on its lines. */
total_tax?: number;
/** @description Taxable value of the invoiced goods and charges. Omitted when pricing_breakdown_available is false. */
taxable_value?: number;
/** @description Delivery and handling taxable values and GST, grouped by rate. Null only when pricing_breakdown_available is false and the invoice has no recorded charge breakdown. */
charge_tax_lines?: {
/** @enum {string} */
charge: "shipping" | "handling";
rate: string;
taxable_value: string;
tax: string;
}[] | null;
/** @description Explicit adjustment from the supply total to the rounded invoice amount. */
round_off?: number | null;
/** @description Supplier, recipient, original supply location and tax heads retained when the document was issued. */
document_context?: {
[key: string]: unknown;
} | null;
/** @description False when a retained invoice, including one issued by Commerce Engine, lacks the original place of supply or the line or charge particulars needed for a reliable tax breakdown. When false, invoice-level taxable_value and tax_summary, and item tax_lines and tax, are omitted. Recorded totals, including the grand total and total tax, are still returned. */
pricing_breakdown_available?: boolean;
};
/**
* ItemListingInventory
* @description The seller's inventory snapshot supplied with a marketplace listing. Its version is the stock version, independently of the listing's own event version.
*/
}OpenAPI Schema
json
{
"title": "InvoiceState",
"description": "A sales invoice for a shipment, or for an order's digital items: one Commerce Engine generates (`invoice_source` `default`, `invoice.*` events) or one issued by the seller (`seller`, `external_invoice.*` events): by the seller, their ERP, or a seller store.",
"type": "object",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/schemas/InvoiceState",
"description": "API reference for the InvoiceState schema"
},
"required": [
"grand_total",
"invoice_date",
"invoice_id",
"invoice_number",
"invoice_source",
"order_id",
"order_number",
"shipment_id"
],
"properties": {
"invoice_number": {
"type": "string"
},
"grand_total": {
"description": "Invoice total: the invoice's own, or, when it has no totals of its own, computed from its lines (`subtotal` + `total_tax` + `shipping_amount` - `coupon_discount_amount`).",
"type": "number"
},
"invoice_id": {
"description": "The invoice number (same as `invoice_number`); the event's key.",
"type": "string"
},
"invoice_source": {
"description": "`seller` for a seller invoice; `default` for one Commerce Engine generates.",
"type": "string",
"enum": [
"seller",
"default"
]
},
"invoice_date": {
"type": [
"string",
"null"
],
"format": "date"
},
"order_id": {
"description": "The order number (same as `order_number`).",
"type": "string"
},
"order_number": {
"type": "string"
},
"shipment_id": {
"description": "The shipment's reference number (same as `reference_number`); `MS:`-prefixed on a seller store's copy of a marketplace shipment. `null` for an invoice of an order's digital items, which have no shipment.",
"type": [
"string",
"null"
]
},
"marketplace_listing": {
"description": "Present when the shipment belongs to a marketplace.",
"type": "array",
"items": {
"type": "object",
"properties": {
"marketplace_id": {
"type": "string"
}
},
"required": [
"marketplace_id"
]
}
},
"invoice_record_id": {
"description": "Commerce Engine's id for the invoice.",
"type": "integer"
},
"invoice_generation": {
"description": "Same as `invoice_record_id`.",
"type": "integer"
},
"status": {
"description": "`printed` by default; `cancelled` on `external_invoice.cancelled`.",
"type": "string"
},
"reference_number": {
"type": [
"string",
"null"
]
},
"warehouse_id": {
"type": [
"string",
"null"
]
},
"shipment_items": {
"description": "The shipment's items, with quantity and free quantity.",
"type": "array",
"items": {
"type": "object",
"properties": {
"product_id": {
"type": "string"
},
"variant_id": {
"type": [
"null",
"string"
]
},
"quantity": {
"type": "integer"
},
"free_quantity": {
"type": "integer"
}
},
"required": [
"free_quantity",
"product_id",
"quantity",
"variant_id"
]
}
},
"billing_business_name": {
"description": "The order's billing business name.",
"type": [
"string",
"null"
]
},
"sub_total": {
"description": "Item total before tax, from the invoice's own totals; not filled when it has none (`subtotal` always is).",
"type": "number"
},
"sub_total_including_tax": {
"description": "Item total including tax.",
"type": "number"
},
"promotion_discount_amount": {
"type": "number"
},
"coupon_discount_amount": {
"description": "Discount on the invoice: its own, or, when it has no totals of its own, its lines' coupon and promotion discounts.",
"type": "number"
},
"loyalty_point_redeemed": {
"description": "Loyalty-point value redeemed against this invoice.",
"type": "number"
},
"shipping_amount": {
"type": "number"
},
"shipping_amount_including_tax": {
"type": "number"
},
"seller_details": {
"description": "Supplier identity and address retained on the invoice; the supplier can be a seller or a store location.",
"anyOf": [
{
"type": "null"
},
{
"type": "object",
"properties": {
"id": {
"type": [
"string",
"null"
]
},
"name": {
"type": [
"string",
"null"
]
},
"gstin": {
"type": [
"string",
"null"
]
},
"state": {
"type": [
"string",
"null"
]
},
"city": {
"type": [
"string",
"null"
]
},
"pincode": {
"type": [
"string",
"null"
]
},
"pinCode": {
"type": [
"string",
"null"
]
},
"address_line1": {
"type": [
"string",
"null"
]
},
"address_line2": {
"type": [
"string",
"null"
]
},
"addressLine1": {
"type": [
"string",
"null"
]
},
"addressLine2": {
"type": [
"string",
"null"
]
},
"pan": {
"type": [
"string",
"null"
]
},
"panNumber": {
"type": [
"string",
"null"
]
},
"tax_identification_number": {
"type": [
"string",
"null"
]
},
"cin": {
"type": [
"string",
"null"
]
},
"drugLicenseNumber": {
"type": [
"string",
"null"
]
},
"drug_license_number": {
"type": [
"string",
"null"
]
},
"trade_name": {
"type": [
"string",
"null"
]
},
"legal_name": {
"type": [
"string",
"null"
]
},
"website": {
"type": [
"string",
"null"
]
},
"country": {
"type": [
"string",
"null"
]
}
}
}
]
},
"irn_number": {
"description": "GST e-invoice Invoice Reference Number.",
"type": [
"null",
"string"
]
},
"ack_number": {
"description": "GST e-invoice acknowledgement number.",
"type": [
"string",
"null"
]
},
"ack_date": {
"description": "GST e-invoice acknowledgement date.",
"type": [
"string",
"null"
],
"format": "date-time"
},
"signed_qr_code": {
"description": "GST e-invoice signed QR code.",
"type": [
"string",
"null"
]
},
"gatepass_barcode": {
"description": "Gate-pass barcode from the seller's ERP.",
"type": [
"string",
"null"
]
},
"items": {
"description": "Invoice lines: the SKU, quantities and price of each invoiced item.",
"type": "array",
"items": {
"type": "object",
"properties": {
"sku": {
"type": "string"
},
"order_item_id": {
"type": "string"
},
"qty": {
"description": "Invoiced quantity.",
"type": "string"
},
"batch_no": {
"description": "Batch number of the goods, from the seller's ERP.",
"type": [
"string",
"null"
]
},
"expiry": {
"description": "Expiry of the batch, from the seller's ERP.",
"type": [
"string",
"null"
]
},
"free_qty": {
"description": "Free (scheme) quantity on top of `qty`.",
"type": [
"string",
"null"
]
},
"item_name": {
"description": "The line's name.",
"type": [
"string",
"null"
]
},
"listing_price": {
"type": "number"
},
"selling_price": {
"type": "number"
},
"selling_price_excluding_tax": {
"type": "number"
},
"tax_rate": {
"type": "number"
},
"tax_type": {
"type": "string"
},
"product_name": {
"type": "string"
},
"product_image_url": {
"type": [
"string",
"null"
]
},
"hsncode": {
"type": [
"string",
"null"
]
},
"coupon_discount_amount": {
"type": "number"
},
"promotion_discount_amount": {
"type": "number"
},
"amount": {
"description": "Selling-price consideration for this invoiced quantity after allocated discounts; includes GST when the selling price includes GST. Use taxable_value for the GST base.",
"type": "number"
},
"subtotal": {
"description": "Accounting line subtotal before coupon and promotion deductions.",
"type": "number"
},
"taxable_value": {
"description": "The GST base retained on the invoice. Earlier before-discount invoices can differ from net_value. Omitted when pricing_breakdown_available is false.",
"type": "number"
},
"tax": {
"description": "GST on the taxable consideration. Omitted when pricing_breakdown_available is false.",
"type": "number"
},
"tax_components": {
"description": "GST apportioned across CGST, SGST, UTGST or IGST for the recorded place of supply. Omitted when the invoice's tax breakdown is unavailable; recorded invoice totals are retained. GST components do not apply to non-GST invoices.",
"type": "object",
"properties": {
"CGST": {
"type": "number"
},
"SGST": {
"type": "number"
},
"UTGST": {
"type": "number"
},
"IGST": {
"type": "number"
}
}
},
"tax_lines": {
"description": "Taxable consideration and GST at each rate applicable to this invoice line. Omitted when pricing_breakdown_available is false.",
"type": "array",
"items": {
"type": "object",
"properties": {
"rate": {
"type": [
"number",
"string"
]
},
"taxable_value": {
"type": [
"number",
"string"
]
},
"tax": {
"type": [
"number",
"string"
]
},
"tax_components": {
"description": "GST apportioned across CGST, SGST, UTGST or IGST for the recorded place of supply. Omitted when the invoice's tax breakdown is unavailable; recorded invoice totals are retained. GST components do not apply to non-GST invoices.",
"type": "object",
"properties": {
"CGST": {
"type": "number"
},
"SGST": {
"type": "number"
},
"UTGST": {
"type": "number"
},
"IGST": {
"type": "number"
}
}
},
"quantity": {
"description": "Units of this line taxed at this rate. A line's tax lines add up to its paid units. Omitted when an earlier invoice didn't record how its units split across rates.",
"type": "string"
},
"net_value": {
"type": [
"number",
"string"
]
}
}
}
},
"pricing_snapshot": {
"description": "Retained monetary amounts used by this issued invoice.",
"type": [
"object",
"null"
],
"additionalProperties": true
},
"price_including_tax": {
"description": "Whether the invoice line’s selling price includes GST.",
"type": "boolean"
},
"net_value": {
"description": "Transaction value after the line’s allocated discounts, excluding GST.",
"type": "number"
},
"pricing_breakdown_available": {
"description": "False when a retained invoice, including one issued by Commerce Engine, lacks the original place of supply or the line or charge particulars needed for reliable tax detail. When false, this item's taxable_value, tax_lines, tax and GST components are omitted. The invoice's recorded totals, including its grand total and total tax, are still returned.",
"type": "boolean"
}
},
"required": [
"qty",
"sku"
]
}
},
"created_at": {
"type": "string"
},
"modified_at": {
"type": "string"
},
"billing_address": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"last_name": {
"type": [
"null",
"string"
]
},
"business_name": {
"type": [
"string",
"null"
]
},
"phone": {
"type": [
"null",
"string"
]
},
"country_code": {
"type": [
"null",
"string"
]
},
"address_line1": {
"type": [
"null",
"string"
]
},
"address_line2": {
"type": [
"string",
"null"
]
},
"landmark": {
"type": [
"string",
"null"
]
},
"pincode": {
"type": [
"null",
"string"
]
},
"city": {
"type": "string"
},
"state": {
"type": [
"null",
"string"
]
},
"country": {
"type": [
"null",
"string"
]
},
"gstin": {
"type": [
"string",
"null"
]
},
"email": {
"type": [
"null",
"string"
]
},
"is_email_verified": {
"type": "boolean"
},
"is_phone_verified": {
"type": "boolean"
}
},
"required": [
"address_line1",
"address_line2",
"business_name",
"city",
"country",
"country_code",
"email",
"first_name",
"gstin",
"is_email_verified",
"is_phone_verified",
"landmark",
"last_name",
"phone",
"pincode",
"state"
]
},
"shipping_address": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"last_name": {
"type": [
"null",
"string"
]
},
"business_name": {
"type": [
"string",
"null"
]
},
"phone": {
"type": [
"null",
"string"
]
},
"country_code": {
"type": [
"null",
"string"
]
},
"address_line1": {
"type": [
"null",
"string"
]
},
"address_line2": {
"type": [
"string",
"null"
]
},
"landmark": {
"type": [
"string",
"null"
]
},
"pincode": {
"type": [
"null",
"string"
]
},
"city": {
"type": "string"
},
"state": {
"type": [
"null",
"string"
]
},
"country": {
"type": [
"null",
"string"
]
},
"gstin": {
"type": [
"string",
"null"
]
},
"email": {
"type": [
"null",
"string"
]
},
"is_email_verified": {
"type": "boolean"
},
"is_phone_verified": {
"type": "boolean"
}
},
"required": [
"address_line1",
"address_line2",
"business_name",
"city",
"country",
"country_code",
"email",
"first_name",
"gstin",
"is_email_verified",
"is_phone_verified",
"landmark",
"last_name",
"phone",
"pincode",
"state"
]
},
"coupon_code": {
"type": [
"null",
"string"
]
},
"tax_summary": {
"description": "GST totals grouped by rate. Omitted when pricing_breakdown_available is false because the retained invoice's place of supply, line particulars or charge particulars are unavailable. Recorded totals, including the grand total and total tax, are still returned.",
"type": "array",
"items": {
"type": "object",
"properties": {
"tax_rate": {
"type": "number"
},
"taxable_value": {
"type": "number"
},
"tax": {
"type": "number"
},
"cgst": {
"type": "number"
},
"sgst": {
"type": "number"
},
"utgst": {
"type": "number"
},
"igst": {
"type": "number"
}
}
}
},
"subtotal": {
"description": "Item total before tax: `sub_total`, or, when the invoice has no totals of its own, the sum of its lines' `subtotal`.",
"type": "number"
},
"total_tax": {
"description": "Total tax: `sub_total_including_tax` - `sub_total`, or, when the invoice has no totals of its own, the tax on its lines.",
"type": "number"
},
"taxable_value": {
"description": "Taxable value of the invoiced goods and charges. Omitted when pricing_breakdown_available is false.",
"type": "number"
},
"charge_tax_lines": {
"description": "Delivery and handling taxable values and GST, grouped by rate. Null only when pricing_breakdown_available is false and the invoice has no recorded charge breakdown.",
"type": [
"array",
"null"
],
"items": {
"type": "object",
"properties": {
"charge": {
"type": "string",
"enum": [
"shipping",
"handling"
]
},
"rate": {
"type": "string"
},
"taxable_value": {
"type": "string"
},
"tax": {
"type": "string"
}
},
"required": [
"charge",
"rate",
"taxable_value",
"tax"
]
}
},
"round_off": {
"description": "Explicit adjustment from the supply total to the rounded invoice amount.",
"type": [
"number",
"null"
]
},
"document_context": {
"description": "Supplier, recipient, original supply location and tax heads retained when the document was issued.",
"type": [
"object",
"null"
],
"additionalProperties": true
},
"pricing_breakdown_available": {
"description": "False when a retained invoice, including one issued by Commerce Engine, lacks the original place of supply or the line or charge particulars needed for a reliable tax breakdown. When false, invoice-level taxable_value and tax_summary, and item tax_lines and tax, are omitted. Recorded totals, including the grand total and total tax, are still returned.",
"type": "boolean"
}
}
}Auto-generated from OpenAPI spec and TypeScript definitions