Edit in GitHubLog an issue
Adobe Commerce only. Learn more

Place a negotiable quote order

This topic describes how REST calls can be used to place items in a shopping cart, initiate and complete the process of negotiating a quote, and reimbursing the buyer's credit upon receipt of payment.

Prerequisites

Prepare the order

The steps in this section are similar to those in the Order processing tutorial, except that different products are added to the cart.

Create a shopping cart

In this example, the customer is a company user (buyer).

Endpoint:

POST /V1/carts/mine

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <customer token>
Copied to your clipboard
// none

Add items

This example adds 15 Pursuit Lumaflex Tone Bands and 10 Harmony Lumaflex Strength Band Kits to the cart. You must make two calls to add these products.

Endpoint:

POST <host>/rest/default/V1/carts/mine

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <customer token>
Copied to your clipboard
{
"cartItem": {
"sku": "24-UG02",
"qty": 15,
"quote_id": "5"
}
}

Set the shipping address

You can determine shipping costs after initiating a negotiable quote, but doing it now provides a more detailed picture of the final costs to the buyer. If you want to defer setting the shipping address until after the negotiable quote has been created, use the /V1/negotiable-carts/:cartId/estimate-shipping-methods call.

Endpoint:

POST <host>/rest/default/V1/carts/mine/estimate-shipping-methods

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <customer token>
Copied to your clipboard
{ "address": {
"region": "California",
"region_id": 12,
"region_code": "CA",
"country_id": "US",
"street": [
"100 Big Tree Avenue"
],
"postcode": "99999",
"city": "San Francisco",
"firstname": "Melanie",
"lastname": "Shaw",
"customer_id": 2,
"email": "mshaw@example.com",
"telephone": "(415) 555-1212",
"same_as_billing": 1
}
}

Set shipping and billing information

You can also set shipping and billing information after initiating a negotiable quote by calling POST /V1/negotiable-carts/:cartId/shipping-information.

Endpoint:

POST /V1/carts/mine/shipping-information

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <customer token>
Copied to your clipboard
{
"addressInformation": {
"shipping_address": {
"region": "California",
"region_id": 12,
"region_code": "CA",
"country_id": "US",
"street": [
"100 Big Tree Avenue"
],
"postcode": "99999",
"city": "San Francisco",
"firstname": "Melanie",
"lastname": "Shaw",
"email": "mshaw@example.com",
"telephone": "415-555-1212"
},
"billing_address": {
"region": "California",
"region_id": 12,
"region_code": "CA",
"country_id": "US",
"street": [
"100 Big Tree Avenue"
],
"postcode": "99999",
"city": "San Francisco",
"firstname": "Melanie",
"lastname": "Shaw",
"email": "mshaw@example.com",
"telephone": "415-555-1212"
},
"shipping_carrier_code": "tablerate",
"shipping_method_code": "bestway"
}
}

View the cart

This is an optional step to show the status of the cart before you begin the negotiable quote process.

Endpoint:

GET /V1/carts/mine

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <customer token>
Copied to your clipboard
// none

Complete a negotiable quote

In this example, the buyer requests a negotiable quote. The seller applies a discount to the quote and returns the quote to the buyer. The buyer accepts the discount and completes the order.

Initiate a negotiable quote

In this example, the buyer initiates a negotiable quote, asking for a 2.5% discount.

Initiating a negotiable quote places it in the processing_by_admin state.

Endpoint:

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

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <admin token>
Copied to your clipboard
{
"quoteId": 5,
"quoteName": "Discount request",
"comment": "Requesting a 2.5% discount"
}

Adjust the negotiable quote

The seller accepts the buyer's request for a 2.5% discount. The negotiated_price_type value of 1 indicates a percentage discount.

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <admin token>

Endpoint:

PUT /V1/negotiableQuote/5

Copied to your clipboard
{
"quote": {
"id": 5,
"extension_attributes": {
"negotiable_quote": {
"negotiated_price_type": 1,
"negotiated_price_value": 2.5
}
}
}
}

Return the negotiable quote to the buyer

Now that the seller has updated the quote, it must be returned to the buyer. The buyer will then be able to either accept the offer and begin the checkout process, or request further negotiations.

This call places the quote in the submitted_by_admin state.

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <admin token>

Endpoint:

POST /V1/negotiableQuote/submitToCustomer

Copied to your clipboard
{
"quoteId": 5,
"comment": "We have applied a 2.5% discount to your order."
}

Get the quote with the new amounts

The price of each item has been reduced by 2.5 percent. In addition, the negotiable_quote section of the response has been updated.

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <admin token>

Endpoint:

GET /V1/carts/5

Copied to your clipboard
// none

Set the payment information and place the order

The buyer is now ready to complete the purchase. Since the buyer has already specified the billing address, only the paymentMethod information must be included.

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <admin token>

Endpoint:

/V1/negotiable-carts/3/payment-information

Copied to your clipboard
{ "paymentMethod": {
"po_number": "12345",
"method": "companycredit"
}
}

Reimburse company credit

Now that the negotiable quote has been converted into an order, you can issue an invoice and create a shipment in the same manner as a standard B2C order. However, when the company pays for the order, the company's outstanding balance must be credited.

In this example, the companyId is 1.

Headers:

Copied to your clipboard
Content-Type application/json
Authorization Bearer <admin token>

Endpoint:

POST /V1/companyCredits/1/increaseBalance

Copied to your clipboard
{
"value": 363.80,
"currency": "USD",
"operationType": 4,
"comment": "Order #3 reimbursed"
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.