This API is used to calculate the price for the individual and summary line items of the cart. It runs the pricing rules, calculate bundle, line item, option level net prices and update the cart line with calculated prices. After the pricing is calculated for the cart line items, the resulting information is stored in the Line Item and Summary Group objects.

This API will also apply all the relevant rules and calculate the pricing including following among others:

  • Line Item level discount
  • Total Price based on the specified quantity
  • Applied Tiered Pricing
  • Apply Ramp Pricing
  • Apply Contractual Pricing
  • Apply Related Pricing Rules
APISignature
computeNetPriceForBundlewebService static Apttus_CPQApi.CPQ.ComputeNetPriceResponseDO computeNetPriceForBundle(Apttus_CPQApi.CPQ.ComputeNetPriceRequestDO request)


Parameters
NameTypeDescription
requestApttus_CPQApi.CPQ.ComputeNetPriceRequestDOThe request data object.


Request Data Object - Apttus_CPQApi.CPQ.ComputeNetPriceRequestDO
FieldTypeDescription
CartIdIDThe Id of the cart.
LineNumberDecimalThe bundle line number.


Response Data Object - Apttus_CPQApi.CPQ.ComputeNetPriceResponseDO
FieldTypeDescription
IsSuccessBooleanIndicates whether getting the total net price was successful.


Code Sample

The sample below prompts the user with the appropriate messages if a cart does not exist or when no products exist in the cart. If the user clicks calculate net price and products exist in the cart, the API computes the net price for all the line numbers of products in the cart with a specific cartID. For example, if the user wants to check the aggregate price of all the products in the cart, you can create a Total Net Price button on your cart page and invoke the computeNetPriceForBundle() API on click of the button. The API will calculate the total price taking into account any discount or pricing rules associated with the line items in the cart.

public void computeNetPriceForBundle()
{
	//If a cart does not exist, there is no cartID. Show the following message to the user. 
	if(cartId == null)
	{
		ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'Please create cart.'));    
	}
	
	//If no products are added to the cart, the lineNumber of the cart is null. Prompt the use to add products to the cart.
	else if(lineNumber == null)
	{
		ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'Please add a bundle to the cart.'));    
	}
	else
	{
		//Selected products are added to the cart. The request object comprises the id of the cart and the line number in the cart
		for(Decimal line: lineNumber)
		{
			Apttus_CPQApi.CPQ.ComputeNetPriceRequestDO request = new Apttus_CPQApi.CPQ.ComputeNetPriceRequestDO();
			request.CartId = cartId;
			request.LineNumber = line;
			
			Apttus_CPQApi.CPQ.ComputeNetPriceResponseDO priceResponse = Apttus_CPQApi.CPQWebService.computeNetPriceForBundle(request);
			ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'Success: ' + priceResponse.IsSuccess));
		}
	}
}
CODE

Integration Details

Use the following information in your integrations with Apttus CPQ Web Services API. Refer to Integrating Apttus with External Systems for information on how to get started.

API Prerequisites

Response/Request XML

Example Request (click to expand)

<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:cpq="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQWebService"
    xmlns:cpq1="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ">
    <soapenv:Header>
        <cpq:SessionHeader>
            <cpq:sessionId>00D4P000000z7dE!AQQAQAHIR1W9.1as89Auz.CvNYxqyg56gLLWgUtP5VZxidvTsb1DpQZpmyDuqZOiF4VctBp3jhhJIxG9oRQ4A4F9h98N0inT</cpq:sessionId>
        </cpq:SessionHeader>
    </soapenv:Header>
    <soapenv:Body>
        <cpq:computeNetPriceForBundle>
            <cpq:request>
                <cpq1:CartId>a1l4P00000Bg7D9QAJ</cpq1:CartId>
                <cpq1:LineNumber>5</cpq1:LineNumber>
            </cpq:request>
        </cpq:computeNetPriceForBundle>
    </soapenv:Body>
</soapenv:Envelope>
XML

Example Response (click to expand)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQWebService" xmlns:ComputeNetPriceResponseDO="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ">
   <soapenv:Body>
      <computeNetPriceForBundleResponse>
         <result>
            <ComputeNetPriceResponseDO:IsSuccess>true</ComputeNetPriceResponseDO:IsSuccess>
         </result>
      </computeNetPriceForBundleResponse>
   </soapenv:Body>
</soapenv:Envelope>
XML