Calculate Price REST API (v16)
Overview
The Calculate
Price REST API is used to calculate the unit price for a product within a specific context such as channel, region, or customer. Using this API allows CPQ to serve as the Pricing Engine for third part or other Oracle applications.
Administration
Description
|
The Calculate
Price REST API is used to calculate the unit price for a product within a specific context such as channel, region, or customer. Using this API allows CPQ to serve as the Pricing Engine for third part or other Oracle applications.
|
URI Endpoint
|
/rest/v16/pricing/actions/calculatePrice
|
Endpoint Parameters
|
None
|
HTTP Method
|
POST
|
Request Body
Parameters
|
currencyCode
|
Currency code for the currency.
|
customerId
|
Customer ID of the customer (account).
|
headerAttributeValues
|
Values of pricing attributes at the header level. (e.g. DateTime, pricingType)
|
priceBookVarName
|
Variable name of the CPQ price book.
The default price book will be used if this parameter is not specified.
|
itemIdentifier
|
An item's unique identifier. This can be any identifier desired by the client.
|
partNumber
|
The unique identifier associated with an Oracle CPQ product.
|
itemAttributeValues
|
Values of pricing attributes for a specific item.
|
|
Variable Name of the CPQ BOM Item. It is empty for a part item. |
|
The exploded line quantity used in Pricing Engine.
For example, in a product hierarchy with 2 child products per root product and 3 grandchild parts per child product, this value will be '6' for the grandchild product when the root quantity is '1', and 12 when the root quantity is '2'. This attribute implicitly maps to the Quantity (_price_quantity) attribute in the quote line Price Attribute Set, but the default can be overridden by explicitly defining a different mapping.
|
Response
Body Parameters
|
_bomItemVariableName
|
Variable Name of the CPQ BOM Item. |
calculationInfo
|
Calculation information from each price model,
listed in order of execution during the price calculation
|
charges
|
Charges from all executed price models.
|
itemIdentifier
|
An item's unique identifier. This matches the item's identifier from the request.
|
partNumber
|
Part Number of the CPQ product.
|
pricePeriod
|
The time period, frequency or recurrence with which the price or charge is levied.
|
priceType
|
The basis on which a price or charge is levied, whether one time, on a periodic basis or based on usage.
|
unitPrice
|
Final calculated unit price of the item.
|
URI Endpoint Sample
https://sitename.oracle.com/rest/v16/pricing/actions/calculatePrice
Sample Request Body
{
"customerId": "ATT",
"currencyCode": "USD",
"priceBookVarName": "_default_price_book",
"headerAttributeValues": {
"oRCL_pRC_priceAsOfDate": "2018-04-23"
},
"items": [{
"itemIdentifier": "1",
"partNumber": "Consumption Fee",
"itemAttributeValues": {
"oRCL_pRC_externalParentKey": "Premium Cloud Backup Service",
"oRCL_pRC_contractStartDate": "2018-04-23",
"oRCL_pRC_quantity": 1990
}
}
]
}
Sample Response Body
{
"items": [{
"itemIdentifier": "1",
"partNumber": "Consumption Fee",
"unitPrice": 0.251256,
"calculationInfo": [{
"listPrice": 500,
"tierList": [{
"TierSequence": 1,
"TierFrom": 1,
"TierTo": 100,
"ListPrice": 0,
"PriceFormat": "ORA_PER_UNIT",
"BlockSize": 1
}, {
"TierSequence": 2,
"TierFrom": 101,
"TierTo": 1000,
"ListPrice": 0.5,
"PriceFormat": "ORA_PER_UNIT",
"BlockSize": 1,
}, {
"TierSequence": 3,
"TierFrom": 1001,
"TierTo": 0,
"ListPrice": 1,
"PriceFormat": "ORA_PER_BLOCK",
"BlockSize": 20,
}
],
"hasErrors": false
}
]
}
]
}
BOM Item Examples
Sample Request Body
{
"priceBookVarName": "_default_price_book",
"customerId": "account112",
"headerAttributeValues": {
"useChargingStation": true
},
"currencyCode": "USD",
"items": [{
"partNumber": "Floor Mats",
"itemIdentifier": "item1",
"itemAttributeValues": {
"_quantity": 2
}
}, {
"partNumber": "Floor Mats2",
"itemIdentifier": "item2",
"itemAttributeValues": {
"_bomItemVariableName": "MFGBOM3",
"_quantity": 2
}
}
]
}
Sample Response Body
{
"items": [{
"itemIdentifier": "item1",
"partNumber": "part14",
"unitPrice": 200.0000,
"calculationInfo": [{
"_priceProfileVar": "additionalProfile",
"_priceProfileName": "Additional Profile"
}
],
"_bomItemVariableName": ""
}, {
"itemIdentifier": "item2",
"partNumber": "part13",
"unitPrice": 13.0000,
"calculationInfo": [],
"_bomItemVariableName": "MFGBOM3"
}
]
}
Example with Charges
Beginning in Oracle CPQ 23C, customers can use this web service to calculate and return both product prices and any charges defined in Pricing Engine.
Sample Response Body
{
"items": [{
"itemIdentifier": "bOMPricingRoot",
"unitPrice": 2222.0000,
"calculationInfo": [{
"_priceProfileVar": "chargeModel2",
"_priceProfileName": "chargeModel2",
"_pricingEngineRuleVar": "_defaultPricingRule",
"_pricingEngineRuleName": "Default Pricing Rule",
"_runningUnitPrice": 2222.00
}
],
"_bomItemVariableName": "bOMPricingRoot",
"priceType": "oneTime",
"pricePeriod": "yearly",
"charges": [{
"unitPrice": 10,
"priceUOM": "ea",
"chargeType": "installationFee",
"priceType": "recurring",
"pricePeriod": "yearly",
"chargeKey": "installationFee_recurring_yearly_ea",
"customAttribute1": "",
"customAttribute2": "",
"customAttribute3": "",
"calculationInfo": [{
"_priceProfileVar": "chargeModel2",
"_priceProfileName": "chargeModel2",
"_pricingEngineRuleVar": "_defaultPricingRule",
"_pricingEngineRuleName": "Default Pricing Rule",
"_runningUnitPrice": 10.00
}
]
}
]
}, {
"itemIdentifier": "bOMPricingChildPart",
"partNumber": "part100",
"unitPrice": 111.0000,
"calculationInfo": [{
"_priceProfileVar": "chargeModel2",
"_priceProfileName": "chargeModel2",
"_pricingEngineRuleVar": "_defaultPricingRule",
"_pricingEngineRuleName": "Default Pricing Rule",
"_runningUnitPrice": 111.00
}
],
"_bomItemVariableName": "bOMPricingChildPart",
"priceType": "oneTime",
"pricePeriod": "yearly",
"charges": [{
"unitPrice": 10,
"priceUOM": "ea",
"chargeType": "installationFee",
"priceType": "recurring",
"pricePeriod": "yearly",
"chargeKey": "installationFee_recurring_yearly_ea",
"customAttribute1": "",
"customAttribute2": "",
"customAttribute3": "",
"calculationInfo": [{
"_priceProfileVar": "chargeModel2",
"_priceProfileName": "chargeModel2",
"_pricingEngineRuleVar": "_defaultPricingRule",
"_pricingEngineRuleName": "Default Pricing Rule",
"_runningUnitPrice": 10.00
}
]
}
]
}
]
}
Examples with Rate Plans and Charge Definitions
Beginning in Oracle CPQ 23D, customers can use this web service to calculate prices with Rate Plans and Charge Definitions.
Rate Plan Examples
Sample Request Body
{
"priceBookVarName": "",
"returnAvailableRatePlans": true,
"customerId": "",
"headerAttributeValues": {
"ratePlanTrigger_c": true,
"_priceAsOf": "2023-05-27T17:07:51"
},
"currencyCode": "USD",
"items": [{
"itemIdentifier": "ratePlanPart",
"partNumber": "ratePlanPart",
"itemAttributeValues": {
"_requestedRatePlanNumber": "summerPlan",
"_quantity": 1
}
}
]
}
Sample Response Body
{
"items": [{
"itemIdentifier": "ratePlanPart",
"partNumber": "ratePlanPart",
"appliedRatePlanIntegrationId": "qp-rm3",
"appliedRatePlanNumber": "rm3",
"appliedRatePlanLabel": "RatePlan M3",
"availableRatePlans": [{
"number": "rm3",
"label": "RatePlan M3",
"integrationId": "qp-rm3"
}, {
"number": "rp-1",
"label": "RatePlan 1",
"integrationId": "qp-summer-plan"
}, {
"number": "rp-2",
"label": "RatePlan 2",
"integrationId": "qp-special-plan"
}
],
"_bomItemVariableName": "",
"unitPrice": 0.0000,
"calculationInfo": [{
"_priceProfileVar": "m5",
"_priceProfileName": "M5",
"_pricingEngineRuleVar": "ratePlanRule",
"_pricingEngineRuleName": "RatePlanRule",
"_runningUnitPrice": 0.0
}
],
"charges": [{
"unitPrice": 498.0000,
"calculationInfo": [{
"_priceProfileVar": "m3",
"_priceProfileName": "M3",
"_pricingEngineRuleVar": "ratePlanRule",
"_pricingEngineRuleName": "RatePlanRule",
"_runningUnitPrice": 500.0
}, {
"_priceProfileVar": "m5",
"_priceProfileName": "M5",
"_pricingEngineRuleVar": "ratePlanRule",
"_pricingEngineRuleName": "RatePlanRule",
"_runningUnitPrice": 498.0
}
],
"chargeKey": "One Time__ORA_SALE",
"chargeType": "ORA_SALE",
"priceType": "One Time",
"rate_c": "22",
"boolean_c": false,
"dateAtt_c": "2023-02-16T08:00:00Z",
"integerAttr_c": 11
}, {
"unitPrice": 6.0000,
"calculationInfo": [{
"_priceProfileVar": "m3",
"_priceProfileName": "M3",
"_pricingEngineRuleVar": "ratePlanRule",
"_pricingEngineRuleName": "RatePlanRule",
"_runningUnitPrice": 10.0
}, {
"_priceProfileVar": "m5",
"_priceProfileName": "M5",
"_pricingEngineRuleVar": "ratePlanRule",
"_pricingEngineRuleName": "RatePlanRule",
"_runningUnitPrice": 6.0
}
],
"chargeKey": "One Time__activationFee",
"chargeType": "activationFee",
"priceType": "One Time",
"rate_c": "22",
"boolean_c": true,
"dateAtt_c": "2023-02-16T08:00:00Z",
"integerAttr_c": 11
}, {
"unitPrice": 7.0000,
"calculationInfo": [{
"_priceProfileVar": "m3",
"_priceProfileName": "M3",
"_pricingEngineRuleVar": "ratePlanRule",
"_pricingEngineRuleName": "RatePlanRule",
"_runningUnitPrice": 10.0
}, {
"_priceProfileVar": "m5",
"_priceProfileName": "M5",
"_pricingEngineRuleVar": "ratePlanRule",
"_pricingEngineRuleName": "RatePlanRule",
"_runningUnitPrice": 7.0
}
],
"chargeKey": "One Time__purchasePrice",
"chargeType": "purchasePrice",
"priceType": "One Time",
"rate_c": "22",
"boolean_c": true,
"dateAtt_c": "2023-02-16T08:00:00Z",
"integerAttr_c": 11
}
]
}
]
}
Charge Definition Examples
Sample Charges with Charge Definitions
{
"primaryCharge": true,
"dynamicPricingType": "static",
"chargeDefinitionCode": "USAGE_SALES_PRICE_c",
"prices": [{
"currencyCode": "USD",
"value": 20
}, {
"currencyCode": "JPY",
"value": 20
}, {
"currencyCode": "GBP ",
"value": 20
}, {
"currencyCode": "EUR",
"value": 20
}, {
"currencyCode": "ALL",
"value": 20
}
]
}
Sample Calculate Price Request Body
{
"customerId": "account138",
"currencyCode": "USD",
"items": [{
"itemIdentifier": "part12",
"itemAttributeValues": {
"_bomItemVariableName": "ABOSampleChild",
"_quantity": 1
}
}, {
"itemIdentifier": "part2000",
"partNumber": "part2000",
"itemAttributeValues": {
"_quantity": 1
}
}
]
}
Sample Calculate Price Response Body
{
"items": [{
"itemIdentifier": "part12",
"chargeDefIntegrationId": "QP_USAGE_SALE_PRICE",
"chargeDefinitionCode": "USAGE_SALES_PRICE_c",
"chargeDefinition": "Usage Price",
"_bomItemVariableName": "ABOSampleChild",
"unitPrice": 20,
"calculationInfo": [{
"_priceProfileVar": "testStaticAPModel1",
"_priceProfileName": "Test Static AP Model1",
"_pricingEngineRuleVar": "alwaysTrueRule1",
"_pricingEngineRuleName": "Always True Rule1",
"_runningUnitPrice": 20
}
],
"priceType": "Usage",
"charges": [{
"unitPrice": 3000,
"calculationInfo": [{
"_priceProfileVar": "testStaticAPModel1",
"_priceProfileName": "Test Static AP Model1",
"_pricingEngineRuleVar": "alwaysTrueRule1",
"_pricingEngineRuleName": "Always True Rule1",
"_runningUnitPrice": 3000
}
],
"chargeKey": "discountPrice_c__quantityBased_c",
"chargeType": "discountPrice_c",
"priceType": "quantityBased_c",
"chargeDefinition": "Quantity Based Discount Price",
"chargeDefIntegrationId": "QUANTITY_BASED_DISCOUNT_PRICE",
"chargeDefinitionCode": "QUANTITY_BASED_DISCOUNT_PRICE_c",
"testCustomStringCA1_c": "value1_c"
}
]
}
]
}
Interface Catalog Enhancements for Calculate Price
The Calculate REST API supports the customization of pricing components contained in the Pricing Calculation Info JSON attribute. Customers can integrate the elements of this JSON attribute with external applications. The Interface Catalog enhancements enable administrators to upload the customer-specific definition for the Calculate Price REST API to the Oracle CPQ Interface Catalog. This creates an accurate reflection of REST API pricing components for web service calls and component mapping such as that used in Oracle’s Integration Cloud Services (ICS).
Custom pricing element definitions are listed within the "profileCalculationInfo" component in the Calculate Price REST API. By defining the custom elements contained in the “profileCalculationInfo” attribute in the REST API metadata, consuming applications can interpret and use these elements to understand the pricing calculations performed by CPQ's Pricing Engine.
Define Custom Pricing Components for the Calculate Price REST API
Complete the following steps to upload the custom definition for the Calculate Price REST API to the Oracle CPQ Interface Catalog:
- Navigate to the Admin Home Page.
-
Under Integration Platform, click Interface Catalogs.
The Interface Catalogs page opens.
-
Click Edit Custom Components.
The Pricing Metadata Definition opens.
-
Enter the custom definition in the profileCalculationInfo Definition field.
Custom Definition Sample
The following definition adds pricing code, extended price, and description items to the Calculate Price REST API.
{
"type": "object",
"title": "Profile Calculation Info",
"description": "Additional information provided by a single price profile that contributed calculations to the final price.",
"properties": {
"pricingComponents": {
"title": "Pricing Description",
"type": "array",
"items": {
"title": "Component",
"type": "object",
"properties": {
"code": {
"title": "Code",
"type": "string",
"description": "Pricing code"
},
"extPrice": {
"title": "Extended Price",
"type": "number",
"description": "Extended price for item"
},
"description": {
"title": "Description",
"type": "string",
"description": "Description for pricing component"
}
}
}
}
}
}
-
Click Save.
The Pricing Metadata Definition is updated to reflect the custom definition.
Related Topics
See Also