Skip to content
Docs
Reference

BackstageClient.taxDocuments

BackstageClient.taxDocuments in @ticketlayer/backstage.

@ticketlayer/backstage


@ticketlayer/backstage / BackstageClient / taxDocuments

taxDocuments: {
  get: (orderId: string, documentId: string, requestOptions?: RequestOptions) => Promise<{
     currency: string;
     data: {
        buyer:   | {
           address: string | null;
           email?: string | null;
           jurisdiction?: string | null;
           name: string | null;
           partyId?: string;
           vatNumber: string | null;
         }
           | null;
        byRate: {
           net: number;
           rate: string | null;
           tax: number;
           treatment: string;
        }[];
        isTest: boolean;
        lines: {
           category: string;
           description: string;
           gross: number;
           lineId: string;
           net: number;
           quantity: number;
           rate: string | null;
           tax: number;
           treatment: string;
        }[];
        orderNumber: string;
        paymentReference: string | null;
        relatesTo:   | {
           documentId: string;
           number: string;
         }
           | null;
        scheme: "uk_vat" | "stripe_tax";
        supplier: {
           address: string | null;
           email?: string | null;
           jurisdiction?: string | null;
           name: string | null;
           partyId?: string;
           vatNumber: string | null;
        };
        title: string;
        totals: {
           gross: number;
           net: number;
           tax: number;
        };
     };
     gross: number;
     id: string;
     issuedAt: string;
     kind: "invoice" | "receipt" | "credit_note";
     net: number;
     number: string;
     orderId: string;
     reference: string;
     refundId: string | null;
     supplier: string;
     tax: number;
  }>;
  issue: (orderId: string, request: {
     buyer?:   | {
        address?: string | null;
        name?: string | null;
        vatNumber?: string | null;
      }
        | null;
     kind: "invoice" | "receipt";
   }, requestOptions?: RequestOptions) => Promise<{
     currency: string;
     data: {
        buyer:   | {
           address: string | null;
           email?: string | null;
           jurisdiction?: string | null;
           name: string | null;
           partyId?: string;
           vatNumber: string | null;
         }
           | null;
        byRate: {
           net: number;
           rate: string | null;
           tax: number;
           treatment: string;
        }[];
        isTest: boolean;
        lines: {
           category: string;
           description: string;
           gross: number;
           lineId: string;
           net: number;
           quantity: number;
           rate: string | null;
           tax: number;
           treatment: string;
        }[];
        orderNumber: string;
        paymentReference: string | null;
        relatesTo:   | {
           documentId: string;
           number: string;
         }
           | null;
        scheme: "uk_vat" | "stripe_tax";
        supplier: {
           address: string | null;
           email?: string | null;
           jurisdiction?: string | null;
           name: string | null;
           partyId?: string;
           vatNumber: string | null;
        };
        title: string;
        totals: {
           gross: number;
           net: number;
           tax: number;
        };
     };
     gross: number;
     id: string;
     issuedAt: string;
     kind: "invoice" | "receipt" | "credit_note";
     net: number;
     number: string;
     orderId: string;
     reference: string;
     refundId: string | null;
     supplier: string;
     tax: number;
  }[]>;
  list: (orderId: string, requestOptions?: RequestOptions) => Promise<{
     currency: string;
     data: {
        buyer:   | {
           address: string | null;
           email?: string | null;
           jurisdiction?: string | null;
           name: string | null;
           partyId?: string;
           vatNumber: string | null;
         }
           | null;
        byRate: {
           net: number;
           rate: string | null;
           tax: number;
           treatment: string;
        }[];
        isTest: boolean;
        lines: {
           category: string;
           description: string;
           gross: number;
           lineId: string;
           net: number;
           quantity: number;
           rate: string | null;
           tax: number;
           treatment: string;
        }[];
        orderNumber: string;
        paymentReference: string | null;
        relatesTo:   | {
           documentId: string;
           number: string;
         }
           | null;
        scheme: "uk_vat" | "stripe_tax";
        supplier: {
           address: string | null;
           email?: string | null;
           jurisdiction?: string | null;
           name: string | null;
           partyId?: string;
           vatNumber: string | null;
        };
        title: string;
        totals: {
           gross: number;
           net: number;
           tax: number;
        };
     };
     gross: number;
     id: string;
     issuedAt: string;
     kind: "invoice" | "receipt" | "credit_note";
     net: number;
     number: string;
     orderId: string;
     reference: string;
     refundId: string | null;
     supplier: string;
     tax: number;
  }[]>;
  render: (orderId: string, documentId: string, requestOptions?: RequestOptions) => Promise<any>;
};

Defined in: client.ts:11809

Tax Documents methods

get()#

get: (orderId: string, documentId: string, requestOptions?: RequestOptions) => Promise<{
  currency: string;
  data: {
     buyer:   | {
        address: string | null;
        email?: string | null;
        jurisdiction?: string | null;
        name: string | null;
        partyId?: string;
        vatNumber: string | null;
      }
        | null;
     byRate: {
        net: number;
        rate: string | null;
        tax: number;
        treatment: string;
     }[];
     isTest: boolean;
     lines: {
        category: string;
        description: string;
        gross: number;
        lineId: string;
        net: number;
        quantity: number;
        rate: string | null;
        tax: number;
        treatment: string;
     }[];
     orderNumber: string;
     paymentReference: string | null;
     relatesTo:   | {
        documentId: string;
        number: string;
      }
        | null;
     scheme: "uk_vat" | "stripe_tax";
     supplier: {
        address: string | null;
        email?: string | null;
        jurisdiction?: string | null;
        name: string | null;
        partyId?: string;
        vatNumber: string | null;
     };
     title: string;
     totals: {
        gross: number;
        net: number;
        tax: number;
     };
  };
  gross: number;
  id: string;
  issuedAt: string;
  kind: "invoice" | "receipt" | "credit_note";
  net: number;
  number: string;
  orderId: string;
  reference: string;
  refundId: string | null;
  supplier: string;
  tax: number;
}>;

Get a tax document

Parameters#

ParameterType
orderIdstring
documentIdstring
requestOptions?RequestOptions

Returns#

Promise<{ currency: string; data: { buyer: | { address: string | null; email?: string | null; jurisdiction?: string | null; name: string | null; partyId?: string; vatNumber: string | null; } | null; byRate: { net: number; rate: string | null; tax: number; treatment: string; }[]; isTest: boolean; lines: { category: string; description: string; gross: number; lineId: string; net: number; quantity: number; rate: string | null; tax: number; treatment: string; }[]; orderNumber: string; paymentReference: string | null; relatesTo: | { documentId: string; number: string; } | null; scheme: "uk_vat" | "stripe_tax"; supplier: { address: string | null; email?: string | null; jurisdiction?: string | null; name: string | null; partyId?: string; vatNumber: string | null; }; title: string; totals: { gross: number; net: number; tax: number; }; }; gross: number; id: string; issuedAt: string; kind: "invoice" | "receipt" | "credit_note"; net: number; number: string; orderId: string; reference: string; refundId: string | null; supplier: string; tax: number; }>

Operation Id#

getOrderTaxDocument

issue()#

issue: (orderId: string, request: {
  buyer?:   | {
     address?: string | null;
     name?: string | null;
     vatNumber?: string | null;
   }
     | null;
  kind: "invoice" | "receipt";
}, requestOptions?: RequestOptions) => Promise<{
  currency: string;
  data: {
     buyer:   | {
        address: string | null;
        email?: string | null;
        jurisdiction?: string | null;
        name: string | null;
        partyId?: string;
        vatNumber: string | null;
      }
        | null;
     byRate: {
        net: number;
        rate: string | null;
        tax: number;
        treatment: string;
     }[];
     isTest: boolean;
     lines: {
        category: string;
        description: string;
        gross: number;
        lineId: string;
        net: number;
        quantity: number;
        rate: string | null;
        tax: number;
        treatment: string;
     }[];
     orderNumber: string;
     paymentReference: string | null;
     relatesTo:   | {
        documentId: string;
        number: string;
      }
        | null;
     scheme: "uk_vat" | "stripe_tax";
     supplier: {
        address: string | null;
        email?: string | null;
        jurisdiction?: string | null;
        name: string | null;
        partyId?: string;
        vatNumber: string | null;
     };
     title: string;
     totals: {
        gross: number;
        net: number;
        tax: number;
     };
  };
  gross: number;
  id: string;
  issuedAt: string;
  kind: "invoice" | "receipt" | "credit_note";
  net: number;
  number: string;
  orderId: string;
  reference: string;
  refundId: string | null;
  supplier: string;
  tax: number;
}[]>;

Issue tax documents for an order Issue the order's receipts now (a paid order; 409 TAX_DOCUMENT_NOT_DUE otherwise) or its invoices: one per supplier, for a business buyer with its name, address and VAT number, or an order paid later. An invoice's reference is the order's invoice number, INV-{orderNumber}. Idempotent: a document already issued is returned as it was. Needs orders.update.

Parameters#

ParameterTypeDescription
orderIdstring-
request{ buyer?: | { address?: string | null; name?: string | null; vatNumber?: string | null; } | null; kind: "invoice" | "receipt"; }-
request.buyer?| { address?: string | null; name?: string | null; vatNumber?: string | null; } | nullDescription An invoice's buyer, where the order's customer is not enough
request.kind?"invoice" | "receipt"
requestOptions?RequestOptions-

Returns#

Promise<{ currency: string; data: { buyer: | { address: string | null; email?: string | null; jurisdiction?: string | null; name: string | null; partyId?: string; vatNumber: string | null; } | null; byRate: { net: number; rate: string | null; tax: number; treatment: string; }[]; isTest: boolean; lines: { category: string; description: string; gross: number; lineId: string; net: number; quantity: number; rate: string | null; tax: number; treatment: string; }[]; orderNumber: string; paymentReference: string | null; relatesTo: | { documentId: string; number: string; } | null; scheme: "uk_vat" | "stripe_tax"; supplier: { address: string | null; email?: string | null; jurisdiction?: string | null; name: string | null; partyId?: string; vatNumber: string | null; }; title: string; totals: { gross: number; net: number; tax: number; }; }; gross: number; id: string; issuedAt: string; kind: "invoice" | "receipt" | "credit_note"; net: number; number: string; orderId: string; reference: string; refundId: string | null; supplier: string; tax: number; }[]>

Operation Id#

issueOrderTaxDocuments

list()#

list: (orderId: string, requestOptions?: RequestOptions) => Promise<{
  currency: string;
  data: {
     buyer:   | {
        address: string | null;
        email?: string | null;
        jurisdiction?: string | null;
        name: string | null;
        partyId?: string;
        vatNumber: string | null;
      }
        | null;
     byRate: {
        net: number;
        rate: string | null;
        tax: number;
        treatment: string;
     }[];
     isTest: boolean;
     lines: {
        category: string;
        description: string;
        gross: number;
        lineId: string;
        net: number;
        quantity: number;
        rate: string | null;
        tax: number;
        treatment: string;
     }[];
     orderNumber: string;
     paymentReference: string | null;
     relatesTo:   | {
        documentId: string;
        number: string;
      }
        | null;
     scheme: "uk_vat" | "stripe_tax";
     supplier: {
        address: string | null;
        email?: string | null;
        jurisdiction?: string | null;
        name: string | null;
        partyId?: string;
        vatNumber: string | null;
     };
     title: string;
     totals: {
        gross: number;
        net: number;
        tax: number;
     };
  };
  gross: number;
  id: string;
  issuedAt: string;
  kind: "invoice" | "receipt" | "credit_note";
  net: number;
  number: string;
  orderId: string;
  reference: string;
  refundId: string | null;
  supplier: string;
  tax: number;
}[]>;

List an order's tax documents The VAT receipts and invoices of the order, one per supplier, and a credit note per refund. A receipt is issued once the order is paid (within a minute); an order whose suppliers are not registered for tax has none. Needs orders.read.

Parameters#

ParameterType
orderIdstring
requestOptions?RequestOptions

Returns#

Promise<{ currency: string; data: { buyer: | { address: string | null; email?: string | null; jurisdiction?: string | null; name: string | null; partyId?: string; vatNumber: string | null; } | null; byRate: { net: number; rate: string | null; tax: number; treatment: string; }[]; isTest: boolean; lines: { category: string; description: string; gross: number; lineId: string; net: number; quantity: number; rate: string | null; tax: number; treatment: string; }[]; orderNumber: string; paymentReference: string | null; relatesTo: | { documentId: string; number: string; } | null; scheme: "uk_vat" | "stripe_tax"; supplier: { address: string | null; email?: string | null; jurisdiction?: string | null; name: string | null; partyId?: string; vatNumber: string | null; }; title: string; totals: { gross: number; net: number; tax: number; }; }; gross: number; id: string; issuedAt: string; kind: "invoice" | "receipt" | "credit_note"; net: number; number: string; orderId: string; reference: string; refundId: string | null; supplier: string; tax: number; }[]>

Operation Id#

listOrderTaxDocuments

render()#

render: (orderId: string, documentId: string, requestOptions?: RequestOptions) => Promise<any>;

A tax document as a printable page The document rendered as a self-contained HTML page (text/html) with what a UK VAT invoice must carry. Browsers fetch it directly and print it to PDF. Needs orders.read.

Parameters#

ParameterType
orderIdstring
documentIdstring
requestOptions?RequestOptions

Returns#

Promise<any>

Operation Id#

renderOrderTaxDocument