data-src=../../includes/commerce-only.md

Initiate a negotiable quote order by seller

This topic describes how a seller can use REST calls to create a negotiable quote for a specific buyer in Draft state, add products to the quote, update quote data such as name and expiration date, and apply a discount.

Prerequisites

Create a negotiable quote

The following example shows the API request workflow for a seller to complete the following tasks:

Initiate a negotiable quote

The seller initiates a negotiable quote by creating a quote for a company buyer.

The new quote is empty with a draft_by_admin system state. In the interface, the quote has a Draft status and is visible only to the seller.

Endpoint:

POST <host>/rest/default/V1/negotiableQuote/draft

Headers:

Content-Type application/json
Authorization Bearer <admin token>
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON

Payload

{
  "customerId": 5
}

Response

`31` // An integer indicating the new quoteId

Update negotiable quote

The seller can now update the quote to add products, and optionally change the negotiable quote name.

Headers:

Content-Type application/json
Authorization Bearer <admin token>

Endpoint:

PUT /V1/negotiableQuote/31

data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON

Payload

{
  "quote": {
    "id": 31,
    "items": [
      {
        "sku": "24-UG02",
        "qty": 1
      },
      {
        "sku": "24-MB01",
        "qty": 100
      }
    ],
    "extension_attributes": {
      "negotiable_quote": {
        "quote_name": "5% for bags"
      }
    }
  }
}

Response

// an empty array

Adjust the negotiable quote

The seller updates the quote to provide a 5% discount that applies to the entire quote. The negotiated_price_type value of 1 indicates a percentage discount.

Headers:

Content-Type application/json
Authorization Bearer <admin token>

Endpoint:

PUT /V1/negotiableQuote/31

data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON

Payload

{
  "quote": {
      "id": 31,
      "extension_attributes": {
        "negotiable_quote": {
         "negotiated_price_type": 1,
          "negotiated_price_value": 5
        }
      }
    }
}

Response

// an empty array

Recalculate prices

Before sending the quote to the buyer, the seller recalculates the prices to reflect the discount.

Headers:

Content-Type application/json
Authorization Bearer <admin token>

Endpoint:

POST /V1/negotiableQuote/pricesUpdated

data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON

Payload

{
  "quoteIds": [31]
}

Response

`true` // indicating the request was successful

Send the negotiable quote to the buyer

After completing updates to the quote, the seller can submit the quote to the buyer for review, including any relevant comments. Then, the buyer can either accept the offer and begin the checkout process, or request further negotiations.

This call places the quote in the submitted_by_admin state. In the interface, the buyer quote status is Updated. The seller quote status is Submitted. At this point, the quote is locked and can be updated only by the buyer.

Headers:

Content-Type application/json
Authorization Bearer <admin token>

Endpoint:

POST /V1/negotiableQuote/submitToCustomer

data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON

Payload

{
  "quoteId": 31,
  "comment": "We have provided a 5% discount to your order."
}

Response

`true` // indicating the request was successful