Skip to content
YasadDocs
Sign inGet started
Developer docs1 min read

Quotes and invoices

Estimates customers accept online, invoices and payments.

Operator keys write quotes and invoices; reader keys read them. Amounts are integers in the currency's smallest unit (cents for USD). Yasad calculates totals and tax, numbers documents without gaps when they're sent or issued, and freezes them from then on.

TypeScript
const quote = await yasad.sales.createQuote({ requestId, customerId, calculation: {
currency: 'USD', taxMode: 'exclusive', taxRates: [], discounts: [],
lines: [{ id: 'labour', description: 'Labour (1.5 h)', quantity: '1.5', unitAmount: 9500, taxRateIds: [] }] } });
const { customerLink } = await yasad.sales.sendQuote(quote.id, { requestId: sendId, expectedRevision: quote.revision, expiresInDays: 30 });
  • customerLink is shown once (a retry returns null; make another with newCustomerLink). It opens Yasad's customer page, where the customer views, downloads and accepts or declines. There is no API for accepting on the customer's behalf: in automated tests, open the link in a headless browser and press Accept quote.
  • Pass customerId to link a Yasad customer. An inline customer (name, email, phone, address) is printed on the document but doesn't create a Yasad customer.
  • After acceptance: convertQuote (once) gives an invoice draft; issueInvoice numbers it (dueInDays) and returns its customer link; recordPayment adds money received (never more than is due; the same amount again within 15 minutes needs confirmDuplicate: true); voidInvoice cancels one with no payments.
  • Lists return the newest 100; sales.page({ kind, before }) continues.
Type to search