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 * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?