Introduction

To use the Price Quotes API, import {priceQuotes} from the wix-billing-backend module:

Copy
import { priceQuotes } from "wix-billing-backend";
Did this help?

createPriceQuote( )


Creates a new price quote.

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.

Method Declaration
Copy
function createPriceQuote(priceQuoteInfo: PriceQuoteInfo): Promise<Response>;
Method Parameters
priceQuoteInfoPriceQuoteInfoRequired

The data used to create a price quote.

Returns
Return Type:Promise<Response>
Create a new price quote
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { priceQuotes } 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", }, billingAddress: { country: "USA", streetAddress: { value: "235 W 23rd St", type: "Name", }, addressLine: "235 W 23rd St, New York, NY 10011, USA", addressLine2: "secondary address", postalCode: "10011", subdivision: "NY", city: "New York", }, shippingAddress: { country: "USA", streetAddress: { value: "235 W 23rd St", type: "Name", }, addressLine: "235 W 23rd St, New York, NY 10011, USA", addressLine2: "secondary address", postalCode: "10011", subdivision: "NY", city: "New York", }, phone: "5555555555", company: "Some Company", companyId: "Some Company Id", fullName: "John Doe", firstName: "John", lastName: "Doe", }; let lineItems = [ { id: "00001", name: "Item 1", description: "First Item", price: 10.5, quantity: 3, taxes: [ { name: "tax name", rate: 8.5, code: "tax code", }, ], }, { id: "00002", name: "Item 2", description: "Second Item", price: 50, quantity: 1, taxes: [ { name: "tax name", rate: 8.5, code: "tax code", }, ], }, ]; 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", source: "Some source", sourceRefId: "Some source ref id", }; let dates = { issueDate: now, validThroughDate: dueDate, }; export const createPriceQuote = webMethod(Permissions.Anyone, () => { let createPriceQuoteFields = { title: "My Price Quote", customer: customer, currency: "USD", lineItems: lineItems, discount: discount, paymentTerms: paymentTerms, metadata: metadata, dates: dates, }; return priceQuotes.createPriceQuote(createPriceQuoteFields); }); /* Promise resolves to: * { * "id": { * "id": "411a5551-b0f6-4826-8a41-ebae2879f857" * "version": 25 * } * } */
Did this help?

deletePriceQuote( )


Deletes a price quote by ID.

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

Method Declaration
Copy
function deletePriceQuote(id: string): Promise<void>;
Method Parameters
idstringRequired

ID of the price quote to delete.

Delete a price quote by ID
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { priceQuotes } from "wix-billing-backend"; export const deletePriceQuote = webMethod(Permissions.Anyone, (id) => { return priceQuotes.deletePriceQuote(id); });
Did this help?

getPriceQuote( )


Gets an existing price quote by ID.

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

Method Declaration
Copy
function getPriceQuote(id: string): Promise<PriceQuote>;
Method Parameters
idstringRequired

The ID of the price quote to get.

Returns
Return Type:Promise<PriceQuote>
Get a price quote by ID
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { priceQuotes } from "wix-billing-backend"; export const getPriceQuote = webMethod(Permissions.Anyone, (id) => { return 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": { * "country": "USA", * "subdivision": "NY", * "city": "New York", * "postalCode": "10011", * "streetAddress": { * "value": "235 W 23rd St", * "type": "Name" * }, * "addressLine": "someStreet", * "formatted": "235 W 23rd St, New York, NY 10011, USA" * }, * "billingAddress": { * "country": "USA", * "streetAddress": { * "value": "235 W 23rd St", * "type": "Name" * }, * "addressLine": "235 W 23rd St, New York, NY 10011, USA", * "postalCode": "10011", * "subdivision": "NY", * "city": "New York", * "formatted": "235 W 23rd St, New York, NY 10011, USA" * }, * "shippingAddress": { * "country": "USA", * "streetAddress": { * "value": "235 W 23rd St", * "type": "Name" * }, * "addressLine": "235 W 23rd St, New York, NY 10011, USA", * "postalCode": "10011", * "subdivision": "NY", * "city": "New York", * "formatted": "235 W 23rd St, New York, NY 10011, USA" * }, * "phone": "5555555555", * "company": "Some Company", * "companyId": "Some Company Id", * "fullName": "John Doe", * "firstName": "John", * "lastName": "Doe" * }, * "dates": { * "issueDate": 2019-03-13T00:00:00.000Z, * "validThroughDate": 2019-06-12T00:00:00.000Z, * "lastSeenDate": 2019-03-14T00: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, * "code": "tax code" * } * ] * }, * { * "id": "00002", * "name": "Item 2", * "description": "Second Item", * "price": 50, * "quantity": 1, * "taxes": [ * { * "name": "tax name", * "rate": 8.5, * "code": "tax code" * } * ] * } * ], * "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, * "code": "tax code" * } * ], * "metadata": { * "notes": "Some note", * "legalTerms": "Some legal terms", * "sourceUrl": "http://legalurl.com", * "source": "Some source", * "sourceRefId": "Some source ref id" * }, * "paymentTerms": { * "termType": "DueOnReceipt", * "termData": "some term data" * }, * "companyId": "Some company id", * "wasSent": true * } */
Did this help?