CorvidReference

priceQuotes

The wix-billing-backend module contains functionality for working with your site's price quotes from backend code.

To use the Price Quotes API, import wixBilling from the wix-billing-backend module:

   import wixBilling from 'wix-billing-backend';

Table of Contents

OBJECTS

?
Objects used when setting, getting, or calling the properties and methods listed above.
AddressAn object that contains address information.
CalculatedTaxAn object that contains calculated tax information.
CustomerAn object that contains customer information.
DiscountAn object that contains discount information.
EmailInfoAn object that contains information used to send a price quote to a customer.
IdAndVersionAn object that contains ID and version information.
ItemizedFeeAn object that contains itemized fee information.
LineItemAn object that contains line item information.
LineItemTaxAn object that contains tax information for a line item.
LocaleAn object that contains locale information.
MetaDataAn object that contains metadata information.
PaymentTermsAn object that contains information about price quote payment terms.
PriceQuoteAn object that represents a price quote.
PriceQuoteDatesAn object that contains date information for a price quote.
PriceQuoteInfoAn object that contains information used when creating or updating a price quote.
ResponseAn object that contains response information.
TotalPriceAn object that contains price totals.

createPriceQuote( )

Creates a new price quote.

Description

The createPriceQuote() function returns a Promise that resolves to the created price quote's ID and version when the price quote is created.

Note

The customer ID and email address listed on the price quote must match an existing contact in the site's contact list.

Syntax

function createPriceQuote(priceQuoteInfo: PriceQuoteInfo): Promise<Response>
PARAMETERS
?
Values that you pass to a function.
priceQuoteInfo
The data used to create a price quote.
RETURN VALUE
?
Value that a function evaluates to when it is finished running.
Promise<Response>
Fulfilled - ID and version of the created price quote.

Examples

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

deletePriceQuote( )

Deletes a price quote by ID.

Description

The deletePriceQuote() function returns a Promise that resolves when the price quote with the specified ID is deleted.

Syntax

function deletePriceQuote(id: string): Promise<void>
PARAMETERS
?
Values that you pass to a function.
id
string
ID of the price quote to delete.
RETURN VALUE
?
Value that a function evaluates to when it is finished running.
Promise<void>
Fulfilled - When the specified price quote is deleted.

Examples

Delete a price quote by ID

import wixBilling from 'wix-billing-backend';

export function deletePriceQuote(id) {
  return wixBilling.priceQuotes.deletePriceQuote(id);
}

getPriceQuote( )

Gets an existing price quote by ID.

Description

The getPriceQuote() function returns a Promise that resolves to the price quote with the specified ID.

Syntax

function getPriceQuote(id: string): Promise<PriceQuote>
PARAMETERS
?
Values that you pass to a function.
id
string
The ID of the price quote to get.
RETURN VALUE
?
Value that a function evaluates to when it is finished running.
Promise<PriceQuote>
Fulfilled - The price quote with the given ID.

Examples

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

sendPriceQuote( )

Sends a price quote preview link to a customer via email.

Description

The sendPriceQuote() function returns a Promise that resolves when the price quote with the specified ID and version is sent to the customer listed on the price quote.

Use the emailOptions parameter to specify the subject and body of the email sent to the customer.

Syntax

function sendPriceQuote(id: IdAndVersion, emailInfo: EmailInfo): Promise<void>
PARAMETERS
?
Values that you pass to a function.
id
ID and version of the price quote to send.
emailInfo
Information used when sending the email.
RETURN VALUE
?
Value that a function evaluates to when it is finished running.
Promise<void>
Fulfilled - When the specified price quote is sent.

Examples

Send a price quote to a customer

import wixBilling from 'wix-billing-backend';

export function sendPriceQuote(id, sendPriceQuoteToCustomerRequest) {
  const idAndVersion = {
    "id": id,
    "version": version
  };

  const emailInfo = {
    "subject": subject,
    "body": body
  };

  return wixBilling.invoices.sendPriceQuote(idAndVersion, emailInfo);
}

Get the price quote version and send the price quote to a customer

import wixBilling from 'wix-billing-backend';

export function sendPriceQuoteToCustomer(id, sendPriceQuoteToCustomerRequest) {
  const emailInfo = {
    "subject": subject,
    "body": body
  };
  
  return wixBilling.invoices.getPriceQuote(id)
    .then( (result) => {
      return wixBilling.invoices.sendPriceQuote(result.id, emailInfo);
    } );
}

updatePriceQuote( )

Updates an existing price quote.

Description

The updatePriceQuote() function returns a Promise that resolves to the updated price quote's ID and version when the price quote is updated.

If the existing price quote contains information that is not included in the updated price quote, that information is lost. For example, if a price quote contains metadata information, but when updating the quote no metadata information is sent, the updated quote will not have any metadata.

Note

The customer listed on the price quote must be an existing site contact or member.

Syntax

function updatePriceQuote(id: IdAndVersion, priceQuoteInfo: PriceQuoteInfo): Promise<Response>
PARAMETERS
?
Values that you pass to a function.
id
ID and version of the price quote to update.
priceQuoteInfo
The data used to update a price quote.
RETURN VALUE
?
Value that a function evaluates to when it is finished running.
Promise<Response>
Fulfilled - ID and version of the created price quote.

Examples

Update an existing price quote

import wixBilling from 'wix-billing-backend';

export function updatePriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id)
    .then( (result) => {
      //make some changes
      result.title = "Updated Title";
      
      let updateFields = {
        "title": result.title,
        "customer": result.customer,
        "currency": result.currency,
        "lineItems": result.lineItems,
        "discount": result.discount,
        "paymentTerms": result.paymentTerms,
        "metadata": result.metadata,
        "dates": result.dates
      };
      return wixBilling.priceQuotes.updatePriceQuote(result.id, updateFields);
    } );
}

Address

An object that contains address information.

See Also

Customer

Syntax

type Address = {
  addressLine: string
  subdivision: string
  city: string
  postalCode: string
  country: string
  formatted: string
}
MEMBERS
?
The properties of an object.
addressLine
string
Address line.
subdivision
string
Address subdivision.
city
string
Address city.
postalCode
string
Address postal code.
country
string
Address country.
formatted
string
Address in human readable format.

Examples

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

CalculatedTax

An object that contains calculated tax information.

See Also

PriceQuote

Syntax

type CalculatedTax = {
  name: string
  rate: number
  taxable: number
  taxed: number
}
MEMBERS
?
The properties of an object.
name
string
Tax name.
rate
number
Tax rate.
taxable
number
Total value of taxable goods.
taxed
number
Total amount of tax applied.

Examples

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

Customer

An object that contains customer information.

See Also

PriceQuote, PriceQuoteInfo, createPriceQuote( ), getPriceQuote( ), updatePriceQuote( )

Syntax

type Customer = {
  contactId: string
  email: string
  address: Address
  phone: string
  company: string
  fullName: string
  firstName: string
  lastName: string
}
MEMBERS
?
The properties of an object.
contactId
string
Contact ID.
email
string
Email address.
address(Optional)
Physical address.
phone(Optional)
string
Phone number.
company(Optional)
string
Company name.
fullName(Optional)
string
Full name.
firstName(Optional)
string
First name.
lastName(Optional)
string
Last name.

Examples

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

Discount

An object that contains discount information.

See Also

PriceQuote, PriceQuoteInfo

Syntax

type Discount = {
  value: number
  type: string
}
MEMBERS
?
The properties of an object.
value
number
Discount amount.
type
string

Discount type.

Either:

  • "Fixed": A fixed amount is deducted.
  • "Percentage": A percentage of the total amount is deducted.

Examples

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

Update an existing price quote

import wixBilling from 'wix-billing-backend';

export function updatePriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id)
    .then( (result) => {
      //make some changes
      result.title = "Updated Title";
      
      let updateFields = {
        "title": result.title,
        "customer": result.customer,
        "currency": result.currency,
        "lineItems": result.lineItems,
        "discount": result.discount,
        "paymentTerms": result.paymentTerms,
        "metadata": result.metadata,
        "dates": result.dates
      };
      return wixBilling.priceQuotes.updatePriceQuote(result.id, updateFields);
    } );
}

EmailInfo

An object that contains information used to send a price quote to a customer.

Syntax

type EmailInfo = {
  subject: string
  body: string
}
MEMBERS
?
The properties of an object.
subject
string
Email subject.
body
string

Email body. Limited formatting in the email body can be achieved using standard JavaScript string formatting.

Examples

Send a price quote to a customer

import wixBilling from 'wix-billing-backend';

export function sendPriceQuote(id, sendPriceQuoteToCustomerRequest) {
  const idAndVersion = {
    "id": id,
    "version": version
  };

  const emailInfo = {
    "subject": subject,
    "body": body
  };

  return wixBilling.invoices.sendPriceQuote(idAndVersion, emailInfo);
}

Get the price quote version and send the price quote to a customer

import wixBilling from 'wix-billing-backend';

export function sendPriceQuoteToCustomer(id, sendPriceQuoteToCustomerRequest) {
  const emailInfo = {
    "subject": subject,
    "body": body
  };
  
  return wixBilling.invoices.getPriceQuote(id)
    .then( (result) => {
      return wixBilling.invoices.sendPriceQuote(result.id, emailInfo);
    } );
}

IdAndVersion

An object that contains ID and version information.

See Also

PriceQuote, UpdatePriceQuoteRequest

Syntax

type IdAndVersion = {
  id: string
  version: number
}
MEMBERS
?
The properties of an object.
id
string
Price quote ID.
version
number
Price quote version.

Examples

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

Update an existing price quote

import wixBilling from 'wix-billing-backend';

export function updatePriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id)
    .then( (result) => {
      //make some changes
      result.title = "Updated Title";
      
      let updateFields = {
        "title": result.title,
        "customer": result.customer,
        "currency": result.currency,
        "lineItems": result.lineItems,
        "discount": result.discount,
        "paymentTerms": result.paymentTerms,
        "metadata": result.metadata,
        "dates": result.dates
      };
      return wixBilling.priceQuotes.updatePriceQuote(result.id, updateFields);
    } );
}

ItemizedFee

An object that contains itemized fee information.

See Also

TotalPrice

Syntax

type ItemizedFee = {
  name: string
  price: number
}
MEMBERS
?
The properties of an object.
name
string
Item fee name.
price
number
Item fee price.

Examples

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

LineItem

An object that contains line item information.

See Also

PriceQuoteInfo

Syntax

type LineItem = {
  id: string
  name: string
  description: string
  price: number
  quantity: number
  taxes: Array<LineItemTax>
}
MEMBERS
?
The properties of an object.
id
string
Line item ID.
name
string
Line item name.
description
string
Line item description.
price
number
Line item price.
quantity
number
Line item quantity.
taxes(Optional)
Line item taxes.

Examples

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

LineItemTax

An object that contains tax information for a line item.

See Also

LineItem

Syntax

type LineItemTax = {
  name: string
  rate: number
}
MEMBERS
?
The properties of an object.
name
string
Line item tax name.
rate
number
Line item tax rate.

Examples

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

Locale

An object that contains locale information.

See Also

PriceQuote

Syntax

type Locale = {
  language: string
}
MEMBERS
?
The properties of an object.
language
string

An IETF language tag. Some common language tags include:

  • "en-US": English, United States
  • "en-GB": English, British
  • "es-ES": Spanish, Spain
  • "de-DE": German, Germany
  • "ja-JP": Japanese, Japan
  • "fr-CH": French, Switzerland
  • "it-IT": Italian, Italy

Examples

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

MetaData

An object that contains metadata information.

See Also

PriceQuote, PriceQuoteInfo

Syntax

type MetaData = {
  notes: string
  legalTerms: string
  sourceUrl: string
}
MEMBERS
?
The properties of an object.
notes(Optional)
string
Price quote notes.
legalTerms(Optional)
string
Legal terms.
sourceUrl(Optional)
string
URL to legal terms.

Examples

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

PaymentTerms

An object that contains information about price quote payment terms.

See Also

PriceQuoteInfo

Syntax

type PaymentTerms = {
  termType: string
  termData: string
}
MEMBERS
?
The properties of an object.
termType
string

Price quote term type. One of:

  • "DueOnReceipt"
  • "NetPlus"
  • "TimeStamp"
  • "Other"
termData(Optional)
string

Term data. When termType is "NetPlus", termData contains a positive integer indicating how many days after the charge payment is due.

Examples

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

PriceQuote

An object that represents a price quote.

See Also

getPriceQuote( )

Syntax

type PriceQuote = {
  id: IdAndVersion
  status: string
  number: string
  title: string
  currency: string
  locale: Locale
  customer: Customer
  lineItems: Array<LineItem>
  discount: Discount
  paymentTerms: PaymentTerms
  taxes: Array<CalculatedTax>
  totals: TotalPrice
  metadata: MetaData
  companyId: string
  invoiceId: string
  dates: PriceQuoteDates
}
MEMBERS
?
The properties of an object.
id
ID and version of the price quote.
status
string

Status of the price quote. One of:

  • "Draft"
  • "Sent"
  • "Processing"
  • "Accepted"
  • "Rejected"
  • "Expired"
  • "Void"
  • "Deleted"
  • "Invoiced"
number
string
Number of the price quote, unique within your site.
title
string
Title of the price quote.
currency
string
Currency code.
locale
Locale information.
customer
Customer listed on the price quote.
lineItems
Array<LineItem>
Line items listed on the price quote.
discount
Discount included in the price quote.
paymentTerms
Payment terms.
taxes
List of taxes calculated based on the line items.
totals
Total values.
metadata
Additional metadata included in the price quote.
companyId
string
Price quote company ID.
invoiceId
string
Price quote invoice ID, when converting price quote to invoice.
dates
Dates associated with the price quote.

Examples

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

PriceQuoteDates

An object that contains date information for a price quote.

See Also

getPriceQuote( ), PriceQuoteInfo

Syntax

type PriceQuoteDates = {
  issueDate: Date
  validThroughDate: Date
  acceptanceDate: Date
  lastSeenDate: Date
}
MEMBERS
?
The properties of an object.
issueDate
Date
Date the price quote was issued.
validThroughDate
Date
Date that the price quote is valid until.
acceptanceDate(Optional)
Date
Date the price quote was accepted.
lastSeenDate(Optional)
Date
Date the price quote was last seen.

Examples

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

PriceQuoteInfo

An object that contains information used when creating or updating a price quote.

See Also

createPriceQuote( ), updatePriceQuote( )

Syntax

type PriceQuoteInfo = {
  title: string
  customer: Customer
  currency: string
  lineItems: Array<LineItem>
  discount: Discount
  paymentTerms: PaymentTerms
  metadata: MetaData
  dates: PriceQuoteDates
}
MEMBERS
?
The properties of an object.
title
string
Title of the price quote.
customer
Customer listed on the price quote.
currency
string
Currency code.
lineItems
Array<LineItem>
Line items listed on the price quote.
discount(Optional)
Discount included in the price quote.
paymentTerms
Payment terms.
metadata(Optional)
Price quote metadata.
dates
Dates associated with the price quote.

Examples

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

Update an existing price quote

import wixBilling from 'wix-billing-backend';

export function updatePriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id)
    .then( (result) => {
      //make some changes
      result.title = "Updated Title";
      
      let updateFields = {
        "title": result.title,
        "customer": result.customer,
        "currency": result.currency,
        "lineItems": result.lineItems,
        "discount": result.discount,
        "paymentTerms": result.paymentTerms,
        "metadata": result.metadata,
        "dates": result.dates
      };
      return wixBilling.priceQuotes.updatePriceQuote(result.id, updateFields);
    } );
}

Response

An object that contains response information.

Syntax

type Response = {
  id: IdAndVersion
}
MEMBERS
?
The properties of an object.
id
ID and version information.

Examples

Create a new price quote

import wixBilling from 'wix-billing-backend';

const now = new Date()
const dueDate = new Date()
dueDate.setDate(now.getDate() + 30)

let customer = {
  // contact ID and email address must match an
  // existing contact in the site's contact list
  "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
  "email": "john.doe@somedomain.com",
  "address": {
    "city": "New York",
    "subdivision": "NY",
    "postalCode": "10011",
    "country": "USA",
    "addressLine": "235 W 23rd St"
  },
  "phone": "5555555555",
  "company": "Some Company",
  "fullName": "John Doe",
  "firstName": "John",
  "lastName": "Doe"
};

let lineItems = [
  {
    "id": "00001",
    "name": "Item 1",
    "description": "First Item",
    "price": 10.50,
    "quantity": 3,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  },
  {
    "id": "00002",
    "name": "Item 2",
    "description": "Second Item",
    "price": 50,
    "quantity": 1,
    "taxes": [{
      "name": "tax name",
      "rate": 8.5
    }]
  }
];

let discount = {
  "value": 2.5,
  "type": "Fixed"
};

let paymentTerms = {
  "termData": "some term data",
  "termType": "DueOnReceipt"
};

let metadata = {
  "notes": "Some note.",
  "legalTerms": "Some legal terms",
  "sourceUrl": "http://legalurl.com"
};

let dates = {
  "issueDate": now,
  "validThroughDate": dueDate
};

export function createPriceQuote() {
  let createPriceQuoteFields = {
    "title": "My Price Quote",
    "customer": customer,
    "currency": "USD",
    "lineItems": lineItems,
    "discount": discount,
    "paymentTerms": paymentTerms,
    "metadata": metadata,
    "dates": dates
  };

  return wixBilling.priceQuotes.createPriceQuote(createPriceQuoteFields);
}

/* Promise resolves to:
 * {
 *   "id": {
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857"
 *     "version": 25
 *   }
 * }
*/

Update an existing price quote

import wixBilling from 'wix-billing-backend';

export function updatePriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id)
    .then( (result) => {
      //make some changes
      result.title = "Updated Title";
      
      let updateFields = {
        "title": result.title,
        "customer": result.customer,
        "currency": result.currency,
        "lineItems": result.lineItems,
        "discount": result.discount,
        "paymentTerms": result.paymentTerms,
        "metadata": result.metadata,
        "dates": result.dates
      };
      return wixBilling.priceQuotes.updatePriceQuote(result.id, updateFields);
    } );
}

TotalPrice

An object that contains price totals.

See Also

PriceQuote

Syntax

type TotalPrice = {
  discountAmount: number
  fees: Array<ItemizedFee>
  taxedAmount: number
  subtotal: number
  total: number
}
MEMBERS
?
The properties of an object.
discountAmount
number
Discount amount.
fees
List of itemized fees.
taxedAmount
number
Sum of line item tax amounts.
subtotal
number
Subtotal of the line items without the tax included.
total
number
Total price of the itemized fees and taxes.

Examples

Get a price quote by ID

import wixBilling from 'wix-billing-backend';

export function getPriceQuote(id) {
  return wixBilling.priceQuotes.getPriceQuote(id);
}

/* Promise resolves to:
 * 
 * {  
 *   "id":{  
 *     "id": "411a5551-b0f6-4826-8a41-ebae2879f857",
 *     "version": 25
 *   },
 *   "status": "Draft",
 *   "number": "0000001",
 *   "title": "My Price Quote",
 *   "currency": "USD",
 *   "customer": {  
 *     "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",
 *     "email": "john.doe@somedomain.com",
 *     "address": {  
 *       "street": "235 W 23rd St",
 *       "city": "New York",
 *       "zip": "10011",
 *       "state": "NY",
 *       "country": "USA"
 *     },
 *     "phone": "5555555555",
 *     "company": "Some Company",
 *     "fullName": "John Doe",
 *     "firstName": "John",
 *     "lastName": "Doe"
 *   },
 *   "dates": {  
 *     "issueDate": 2019-03-13T00:00:00.000Z,
 *     "validThroughDate": 2019-06-12T00:00:00.000Z
 *   },
 *   "discount": {
 *     "value": 2.5,
 *     "type": "Fixed"
 *   },
 *   "lineItems":[  
 *     {  
 *       "id": "00001",
 *       "name": "Item 1",
 *       "description": "First Item",
 *       "price": 10.5,
 *       "quantity": 3,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     },
 *     {  
 *       "id": "00002",
 *       "name": "Item 2",
 *       "description": "Second Item",
 *       "price": 50,
 *       "quantity": 1,
 *       "taxes": [
 *         {
 *           "name": "tax name",
 *           "rate": 8.5
 *         }
 *       ]
 *     }
 *   ],
 *   "locale": {
 *     "language": "en"
 *   },
 *   "totals": {
 *     "discountAmount": null,
 *     "taxedAmount": 6.93,
 *     "fees": [],
 *     "subtotal": 81.5,
 *     "total": 88.43
 *   },
 *   "taxes": [
 *     {
 *       "name": "tax name",
 *       "rate": 8.5,
 *       "taxable": 81.5,
 *       "taxed": 6.93
 *     }
 *   ],
 *   "metadata": {
 *     "notes": "Some note",
 *     "legalTerms": "Some legal terms",
 *     "sourceUrl": "http://legalurl.com"
 *   },
 *   "paymentTerms": {
 *     "termType": "DueOnReceipt",
 *     "termData": "some term data"
 *   }
 * }
 */