Quote API & Webhooks Guide
Overview
The Quotes API allows developers to integrate to pull quote details including line items from other applications.
All request must have Authorization header with bearer token (can be generated in Solarplus integration page /user/api). See Solarplus REST Api Documentation for more info.
Get Contact Quotes
Endpoint: /api/contact/quotes/<contact_id>
Example: http://go.solarplus.co/api/contact/quotes/25487
Request Method: GET
Result:
{ "success": true, "message": "Successfully retrieved contact quotes.", "data": { "contact_id": "25487", "quotes": [ { "system_id": "34562", "quote_status": "Lead", "quote_no": "4416", "quote_total_payable": 26237.32, "quote_sales_tax": 3476.12, "quote_discounts": 0, "quote_view_url": "http://go.solarplus.co/system/viewQuote/34562", "quote_pdf": "http://go.solarplus.co/system/quotePdf/34562?business_quote_id=SolarPlus+2016" }, { "system_id": "34563", "quote_status": "Lead", "quote_no": "4417", "quote_total_payable": 28290.63, "quote_sales_tax": 2797.33, "quote_discounts": 0, "quote_view_url": "http://go.solarplus.co/system/viewQuote/34563", "quote_pdf": "http://go.solarplus.co/system/quotePdf/34563?business_quote_id=SolarPlus+2016" } ] } }
Get Quote Line Items
Endpoint: /api/quote/lineItems/<quote_system_id> (not quote-number)
Example: http://go.solarplus.co/api/quote/lineItems/34562
Request Method: GET
Results:
{ "success": true, "message": "Successfully retrieved quote line items.", "data": { "quote_id": "35197", "quote_number": "huh-12600175", "quote_status": "Approved", "contact_details": { "contact_name": "test t", "contact_email": "test@te.com" }, "date_created": "2021-05-21 09:59:24", "quote_valid_date": "2021-06-20", "proposal_url": "https:\/\/my.sp.com\/file\/viewPdf?f=Renewable_proposal_35197.pdf&d=performance&h=j4n224n454w5m5k4v5j474f44494o3n5f464o4h5a4e49424h4z5n4o4m4s4a4u554r2a434b4b404w544a4", "installer_job_pack_url": "https:\/\/my.sp.com\/file\/viewPdf?f=Install_job_pack_35197.pdf&d=install&h=j4n224g4e4x50664p5i4j3f4k4o434u5d404b4v5a414k44444s574z203y263d4s2g4l5k5", "commissioning_url": "https:\/\/my.sp.com\/file\/viewPdf?f=System_manual_35197.pdf&d=commissioning&h=j4n224a4f4r5t5e4w5p4f4g4f4d4g4p5o3q4k406d4f434g424v5t494j48403b4v2x2c404u5k5k5", "quote_acceptance_link": "https://my.sp.com/system/receiveQuote/x28474q244", "currency": "USD", "line_amount_types": "INCLUSIVE", "quote_total": 12000, "quote_total_gst": 1091.13, "quote_total_loan_amount": "12000.00", "quote_total_payable": 0, "loan_type": "Cash + Part Finance", "line_items": [ { "inventory_id": "42417", "sku_code": null, "item_name": "Storage - Balance Of System and Labour for Battery Back Up Systems ", "wholesale_price": 0, "mark_up": 0, "supplier_id": null, "item_qty": 1, "sell_price": 1.02, "line_total": 1.12, "sales_tax": 0.1 }, { "inventory_id": "38880", "sku_code": "X3-Hybrid-10.0T", "item_name": "X3-Hybrid-10.0T", "wholesale_price": 4500, "mark_up": 10, "supplier_id": "293", "item_qty": 3, "sell_price": 5040, "line_total": 16632, "sales_tax": 1512 }, { "inventory_id": "42404", "sku_code": null, "item_name": "Aide Solar XZST-190W", "wholesale_price": 0, "mark_up": 0, "supplier_id": null, "item_qty": 39, "sell_price": 16.8, "line_total": 720.72, "sales_tax": 65.52 }, { "inventory_id": "42404", "sku_code": null, "item_name": "Aide Solar XZST-190W", "wholesale_price": 0, "mark_up": 0, "supplier_id": null, "item_qty": 9, "sell_price": 1.12, "line_total": 11.09, "sales_tax": 1.01 }, { "inventory_id": "42404", "sku_code": null, "item_name": "Aide Solar XZST-190W", "wholesale_price": 0, "mark_up": 0, "supplier_id": null, "item_qty": 1, "sell_price": 34.32, "line_total": 37.75, "sales_tax": 3.43 }, { "inventory_id": "35588", "sku_code": " P370", "item_name": " P370", "wholesale_price": 400, "mark_up": 15, "supplier_id": "293", "item_qty": 3, "sell_price": 448, "line_total": 0, "sales_tax": 0 }, { "inventory_id": "42159", "sku_code": "discount", "item_name": "discount", "wholesale_price": 570, "mark_up": 0, "supplier_id": null, "item_qty": 1, "sell_price": -1.23, "line_total": -1.23, "sales_tax": 0 }, { "inventory_id": "42376", "sku_code": null, "item_name": "subsidy test tax", "wholesale_price": 0, "mark_up": 0, "supplier_id": null, "item_qty": 1, "sell_price": -1.23, "line_total": -1.23, "sales_tax": 0 }, { "inventory_id": "0", "sku_code": null, "item_name": "STC incentives - 96 STCs @ $40.00", "wholesale_price": 0, "mark_up": 0, "supplier_id": null, "item_qty": 1, "sell_price": 0, "line_total": 0, "sales_tax": 0 }, { "inventory_id": "0", "sku_code": null, "item_name": "Discount Applied (31% of final price):", "wholesale_price": 0, "mark_up": 0, "supplier_id": null, "item_qty": 1, "sell_price": -4909.29, "line_total": -5400.21, "sales_tax": -490.93 } ], "quote_approve_date": "2021-05-26 04:33:48", "quote_installer_acceptance_status": null } }
Available Arguments:
"showHidden" : defaults to true, if set to false it will omit the hidden line items from the list
Sample Request:
Return Values:
"quote_id": Quote ID
"quote_number": Quote number with prefix specified on business settings
"quote_status": [Draft, Approved, Modified , With Customer, Rejected, Completed]
"contact_details": { "contact_name" : Contact Name, "contact_email" : Contact Email, defaults to NULL }
"date_created": Date quote is created
"quote_valid_date" : The date up to which the quote is valid
"proposal_url": link to Proposal Report
"installer_job_pack_url" : link to Installer Job Pack Report
"commissioning_url" : link to Commissioning Report
"quote_acceptance_link": link to quote acceptance page
"currency": ISO code of the currency used in the quote,
"line_amount_types": set to "INCLUSIVE" if Apply Tax Settings is enabled on Business Settings, if not "NO TAX" is set
"quote_total": Final price calculated for the quote
"quote_total_gst": Total GST on the quote
"quote_total_loan_amount": Total loan amount taken from the Finance Purchase Plan applied on the quote, if quote uses Cash only, 0 is returned
"quote_total_payable": Total payable price ( Final Price - Loan Amount)
"loan_type": [ Cash , Loan, Cash + Finance , Lease , Mortgage , Power Purchase]
"quote_approve_date" : returns the approval date of the quote, if quote is not yet approved it returns NULL
"quote_installer_acceptance_status" : returns the status of the installer acceptance, if the installer has not given a response yet it returns NULL
Additional Notes :
line item "sell_price" : unit retail price ex. gst
line item "line_total": sell_price * item_qty
line item "sales_tax" : total tax applied on the item
stc block: contains details regarding the stc
discount block : contains details regarding any discount applied either line item discount / custom discount or supplier discount
Add Quote Line Item
Endpoint: /api/quote/addItem/<system_id>
Example: http://go.solarplus.co/api/quote/addItem/34562
Request Method: POST
The Quotes API supports add items to an existing quote.
In order for an item to be included in a quote it must be in the Inventory, however you can add an item to the inventory and to a quote with a single API call.
in this case for existing inventory items , we only need to require the inventory id.
Add item to quote using an existing inventory item
if user wants to add a non-existing inventory item to the quote we will need the ff. fields:
name: (required) 150 characters only
category_id : (required )
quote_item_quantity: (optional , defaults to 1)
foreign_id : ( required for battery / module / inverter )
kit_value : default to false
cost_of_sales_inc: ('The item is purchased') defaults to false for service categories, defaults to true for other categories
quote_default : defaults to false
description : optional
code : (SKU) required if cost_of_sales_inc is true, auto generated if cost_of_sales_inc is false
supplier : ( required if cost_of_Sales_inc is true, will only accept supplier of type not finance provider and from the same business)
unit_price : ( not required ) defaults to 0
unit_of_measure : (not required ) default to per item
markup_value : (not required) defaults to 0
markup_is_percentage : (not required ) defaults to true
quantity : ( not required , this is for kit_value = true ) defaults to 0
spare_qty : ( not required , this is for kit_value = true ) defaults to 0
is_default : defaults to false
Add item to quote and create inventory item with Service category (see below list of service categories)
Add item to quote and create inventory item for an EXISTING component in SolarPlus Product Library ONLY
Components such as inventory, modules, and batteries should generally only be used to a system design, not as a quote item (or it will not be included in any performance and savings analysis).
If you do want to add such a component to a quote and not include it in the reporting metrics, first get the specific component ID and use the category for that type of product (eg. Inverter/PCE or Module or Battery)
Add item to quote and create inventory item with mounting kit ONLY
Only when adding a mounting kit (in which there may be multiple kit components), use the Kit Value = 1
Add existing inventory item to quote using existing Inventory product ID and item quantity
quote_item_quantity
a.) This field will overwrite the calculated quantity for the item on the quote. Please take note that for inventory items with Per Item UOM,
the default value is 1 and for non-Per Item UOM, the default value is calculated based on the Kilowatt / Watt / Panel of the quote.
b.) This field cannot be applied to Kits, even if this field is specified Kits will still only have quantity 1 as its value.
c.) In relation to a.), please take note that inventories that do not have a Per Item UOM, the quantity is always automatically recalculated
whenever there are changes to the quote. Once a custom quantity is supplied, the quantity for that item will not be recalculated anymore.
E.g
A.) Without specifiying quote_item_quantity
Given : Item A - Per KW
Quote 12345 - 25 kW
Actions:
a.) add Item A
b.) Item A, qty is now 25
c.) Make changes to quote, add inverters and modules
d.) Now new quote kilowatt is 30 kw
e.) The system automatically updates Item A qty to 30
B.) Specifying quote_item_quantity
Given: Item A - Per KW
Quote 12345 - 25 kW
Actions:
a.) add Item A with quote_item_quantity = 20
b.) Item A, qty is now 20
c.) Make changes to quote, add inverters and modules
d.) Now new quote kilowatt is 30 kw
e.) Item A qty STILL 20
service categories :
These categories do not require a supplier ID as the business is generally supplying the service themselves.
Labour
Difficulty surcharges
Trave1320pxl/Freight
Administrative
Miscellaneous
Warranty
Subsidy
Discount
Send Quote and Proposal
A quote can be sent via API including the Proposal PDF and including a link to the customer online acceptance webpage.
request link : https://{{domain}}/api/quote/sendQuote/35122
variables are :
email : required, customer email
email_content : optional, defaults to default business email content
quote_template : optional, defaults to default quote template ( a business can configure custom email content HTML templates)
performance_template : optional, defaults to default Proposal template ( a business can configure custom Proposal HTML templates)
add_brochure : optional, defaults to false
subject : optional, defaults to saved email subject for quote
include_quote_and_performance : optional, defaults to TRUE to send the full Proposal with the email
include_invoice : optional, will return error if no invoice is created yet for the quote
include_quote_only : optional, send short form Quote PDF instead of Proposals
include_no_pdf : optional, send Invoice PDF instead of Proposal or quote PDF
bcc : optional, defaults to null
Security: All request must have Authorization header with bearer token (can be generated in Solarplus integration page /user/api). See Solarplus REST Api Documentation for more info.
Sample Postman HTTP Request:
GET /api/quote/lineItems/34562 HTTP/1.1 Host: go.solarplus.co Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9kZXYuc29sYXJwbHVzLmxvY2FsXC9hcGlcLyIsImlhdCI6MTU1NjI0NzU5NiwidWlkIjoiMTA4OCJ9.49xOygt4VD2GH1atdanOwLTHffgKNSeUFO_uo41iyGc User-Agent: PostmanRuntime/7.11.0 Accept: */* Cache-Control: no-cache Postman-Token: 9087dd6b-e922-4771-81ca-f06a74830e45,088a865e-99e5-4d63-98ec-5b3eb4723a92 Host: go.solarplus.co cookie: PHPSESSID=pqacvurhesjd7pdoog3d9gnc73; 7f7a7a2e2a163508aaa11af0dc52fc69=155edfe33823ad6c97178cfda3f7180124fd3775a%3A4%3A%7Bi%3A0%3Bs%3A4%3A%221088%22%3Bi%3A1%3Bs%3A8%3A%22solarone%22%3Bi%3A2%3Bi%3A3600%3Bi%3A3%3Ba%3A17%3A%7Bs%3A9%3A%22lastLogin%22%3Bi%3A1553444633%3Bs%3A9%3A%22firstName%22%3Bs%3A6%3A%22Laurie%22%3Bs%3A8%3A%22lastName%22%3Bs%3A4%3A%22Kane%22%3Bs%3A8%3A%22fullName%22%3Bs%3A11%3A%22Laurie+Kane%22%3Bs%3A5%3A%22email%22%3Bs%3A19%3A%22laurie%40solarplus.co%22%3Bs%3A12%3A%22primaryPhone%22%3Bs%3A12%3A%220448+448+448%22%3Bs%3A14%3A%22secondaryPhone%22%3Bs%3A0%3A%22%22%3Bs%3A8%3A%22username%22%3Bs%3A8%3A%22solarone%22%3Bs%3A10%3A%22businessId%22%3Bs%3A3%3A%22911%22%3Bs%3A9%3A%22agreeEULA%22%3Bs%3A1%3A%221%22%3Bs%3A8%3A%22logoPath%22%3Bs%3A41%3A%22images%2Fbusiness%2F911%2Fthumb_solar_focus.png%22%3Bs%3A12%3A%22businessName%22%3Bs%3A13%3A%22Solar+Focus.+%22%3Bs%3A13%3A%22quotesEnabled%22%3Bb%3A1%3Bs%3A9%3A%22coverPath%22%3Bs%3A33%3A%22images%2Fsystem_docs%2Fcover-page.png%22%3Bs%3A19%3A%22systemManualEnabled%22%3Bb%3A1%3Bs%3A2%3A%22id%22%3Bs%3A4%3A%221088%22%3Bs%3A4%3A%22__id%22%3Bs%3A4%3A%221088%22%3B%7D%7D accept-encoding: gzip, deflate Connection: keep-alive cache-control: no-cache
Sample PHP Curl Request:
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://go.solarplus.co/api/quote/lineItems/34562", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_POSTFIELDS => "", CURLOPT_HTTPHEADER => array( "Accept: */*", "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9kZXYuc29sYXJwbHVzLmxvY2FsXC9hcGlcLyIsImlhdCI6MTU1NjI0NzU5NiwidWlkIjoiMTA4OCJ9.49xOygt4VD2GH1atdanOwLTHffgKNSeUFO_uo41iyGc", "Cache-Control: no-cache", "Connection: keep-alive", "Host: go.solarplus.co", "Postman-Token: 9087dd6b-e922-4771-81ca-f06a74830e45,00e4f15d-edc5-459c-b172-fbba85fc43f5", "User-Agent: PostmanRuntime/7.11.0", "accept-encoding: gzip, deflate", "cache-control: no-cache", "cookie: PHPSESSID=pqacvurhesjd7pdoog3d9gnc73; 7f7a7a2e2a163508aaa11af0dc52fc69=155edfe33823ad6c97178cfda3f7180124fd3775a%3A4%3A%7Bi%3A0%3Bs%3A4%3A%221088%22%3Bi%3A1%3Bs%3A8%3A%22solarone%22%3Bi%3A2%3Bi%3A3600%3Bi%3A3%3Ba%3A17%3A%7Bs%3A9%3A%22lastLogin%22%3Bi%3A1553444633%3Bs%3A9%3A%22firstName%22%3Bs%3A6%3A%22Laurie%22%3Bs%3A8%3A%22lastName%22%3Bs%3A4%3A%22Kane%22%3Bs%3A8%3A%22fullName%22%3Bs%3A11%3A%22Laurie+Kane%22%3Bs%3A5%3A%22email%22%3Bs%3A19%3A%22laurie%40solarplus.co%22%3Bs%3A12%3A%22primaryPhone%22%3Bs%3A12%3A%220448+448+448%22%3Bs%3A14%3A%22secondaryPhone%22%3Bs%3A0%3A%22%22%3Bs%3A8%3A%22username%22%3Bs%3A8%3A%22solarone%22%3Bs%3A10%3A%22businessId%22%3Bs%3A3%3A%22911%22%3Bs%3A9%3A%22agreeEULA%22%3Bs%3A1%3A%221%22%3Bs%3A8%3A%22logoPath%22%3Bs%3A41%3A%22images%2Fbusiness%2F911%2Fthumb_solar_focus.png%22%3Bs%3A12%3A%22businessName%22%3Bs%3A13%3A%22Solar+Focus.+%22%3Bs%3A13%3A%22quotesEnabled%22%3Bb%3A1%3Bs%3A9%3A%22coverPath%22%3Bs%3A33%3A%22images%2Fsystem_docs%2Fcover-page.png%22%3Bs%3A19%3A%22systemManualEnabled%22%3Bb%3A1%3Bs%3A2%3A%22id%22%3Bs%3A4%3A%221088%22%3Bs%3A4%3A%22__id%22%3Bs%3A4%3A%221088%22%3B%7D%7D" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Web Hooks
To access web hooks visit
https://go.solarplus.co/webHook/admin
Web hooks enable you to trigger actions in external applications when a quote in SolarPlus:
- Has the quote status updated
- Has the quote deleted
Creating a webhook
Webhook Fields:
URL - HTTPS URL for external application
Content Type
Secret (from External application)
Events - trigger events
Viewing Webhooks
You can view existing webhooks and filter this list.
- Actions:
- View deliveries
- Edit
- Delete