Search...
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>
createPriceQuote Parameters
NAME
TYPE
DESCRIPTION
priceQuoteInfo
PriceQuoteInfo
The data used to create a price quote.
Returns
Fulfilled - ID and version of the created price quote.
Return Type:
Promise<Response>
NAME
TYPE
DESCRIPTION
id
IdAndVersion
ID and version information.
Was this helpful?
Create a new price quote
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { priceQuotes } from 'wix-billing-backend';34const now = new Date();5const dueDate = new Date();6dueDate.setDate(now.getDate() + 30);78let customer = {9 // contact ID and email address must match an10 // existing contact in the site's contact list11 "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",12 "email": "john.doe@somedomain.com",13 "address": {14 "city": "New York",15 "subdivision": "NY",16 "postalCode": "10011",17 "country": "USA",18 "addressLine": "235 W 23rd St"19 },20 "billingAddress": {21 "country": "USA",22 "streetAddress": {23 "value": "235 W 23rd St",24 "type": "Name"25 },26 "addressLine": "235 W 23rd St, New York, NY 10011, USA",27 "addressLine2": "secondary address",28 "postalCode": "10011",29 "subdivision": "NY",30 "city": "New York"31 },32 "shippingAddress": {33 "country": "USA",34 "streetAddress": {35 "value": "235 W 23rd St",36 "type": "Name"37 },38 "addressLine": "235 W 23rd St, New York, NY 10011, USA",39 "addressLine2": "secondary address",40 "postalCode": "10011",41 "subdivision": "NY",42 "city": "New York"43 },44 "phone": "5555555555",45 "company": "Some Company",46 "companyId": "Some Company Id",47 "fullName": "John Doe",48 "firstName": "John",49 "lastName": "Doe"50};5152let lineItems = [53 {54 "id": "00001",55 "name": "Item 1",56 "description": "First Item",57 "price": 10.50,58 "quantity": 3,59 "taxes": [{60 "name": "tax name",61 "rate": 8.5,62 "code": "tax code"63 }]64 },65 {66 "id": "00002",67 "name": "Item 2",68 "description": "Second Item",69 "price": 50,70 "quantity": 1,71 "taxes": [{72 "name": "tax name",73 "rate": 8.5,74 "code": "tax code"75 }]76 }77];7879let discount = {80 "value": 2.5,81 "type": "Fixed"82};8384let paymentTerms = {85 "termData": "some term data",86 "termType": "DueOnReceipt"87};8889let metadata = {90 "notes": "Some note.",91 "legalTerms": "Some legal terms",92 "sourceUrl": "http://legalurl.com",93 "source": "Some source",94 "sourceRefId": "Some source ref id"95};9697let dates = {98 "issueDate": now,99 "validThroughDate": dueDate100};101102export const createPriceQuote = webMethod(Permissions.Anyone, () => {103 let createPriceQuoteFields = {104 "title": "My Price Quote",105 "customer": customer,106 "currency": "USD",107 "lineItems": lineItems,108 "discount": discount,109 "paymentTerms": paymentTerms,110 "metadata": metadata,111 "dates": dates112 };113114 return priceQuotes.createPriceQuote(createPriceQuoteFields);115});116117/* Promise resolves to:118 * {119 * "id": {120 * "id": "411a5551-b0f6-4826-8a41-ebae2879f857"121 * "version": 25122 * }123 * }124*/