POST
/
v1
/
pricing-rules
/
calculate
curl --location --request POST 'https://api.stateset.com/v1/pricing-rules/calculate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
    "customer_segment": "wholesale",
    "channel": "b2b",
    "items": [
        {
            "product_id": "prod_electronics_001",
            "quantity": 75,
            "list_price": 9999,
            "category_id": "cat_electronics"
        },
        {
            "product_id": "prod_accessories_001",
            "quantity": 10,
            "list_price": 1999,
            "category_id": "cat_accessories"
        }
    ]
}'
{
  "object": "price_calculation",
  "items": [
    {
      "product_id": "prod_electronics_001",
      "quantity": 75,
      "list_price": 9999,
      "final_price": 8499,
      "unit_discount": 1500,
      "total_discount": 112500,
      "subtotal": 637425,
      "applied_rules": [
        {
          "rule_id": "pr_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
          "rule_name": "B2B Volume Pricing - Electronics",
          "type": "volume_based",
          "discount_percentage": 15,
          "quantity_tier": "50-99"
        }
      ]
    },
    {
      "product_id": "prod_accessories_001",
      "quantity": 10,
      "list_price": 1999,
      "final_price": 1999,
      "unit_discount": 0,
      "total_discount": 0,
      "subtotal": 19990,
      "applied_rules": [],
      "reason_no_discount": "category_not_eligible"
    }
  ],
  "summary": {
    "total_list_price": 769915,
    "total_discount": 112500,
    "total_final_price": 657415,
    "discount_percentage": 14.6,
    "currency": "USD"
  },
  "rules_considered": 3,
  "rules_applied": 1,
  "calculation_timestamp": "2024-06-20T16:30:00Z"
}
This endpoint calculates final prices for products by applying all applicable pricing rules based on customer, quantity, and other conditions.

Authentication

This endpoint requires a valid API key with pricing:read permissions.
Authorization: Bearer YOUR_API_KEY

Request Body

customer_id
string
Customer ID for customer-specific pricing
customer_segment
string
Customer segment if customer_id not provided
channel
string
Sales channel: “web”, “pos”, “b2b”, “marketplace”
items
array
required
Products to calculate pricing for
currency
string
Currency code (default: account currency)
date
string
Date for time-based pricing (ISO 8601)

Response

Returns calculated prices with applied rules breakdown.
curl --location --request POST 'https://api.stateset.com/v1/pricing-rules/calculate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
    "customer_segment": "wholesale",
    "channel": "b2b",
    "items": [
        {
            "product_id": "prod_electronics_001",
            "quantity": 75,
            "list_price": 9999,
            "category_id": "cat_electronics"
        },
        {
            "product_id": "prod_accessories_001",
            "quantity": 10,
            "list_price": 1999,
            "category_id": "cat_accessories"
        }
    ]
}'
{
  "object": "price_calculation",
  "items": [
    {
      "product_id": "prod_electronics_001",
      "quantity": 75,
      "list_price": 9999,
      "final_price": 8499,
      "unit_discount": 1500,
      "total_discount": 112500,
      "subtotal": 637425,
      "applied_rules": [
        {
          "rule_id": "pr_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
          "rule_name": "B2B Volume Pricing - Electronics",
          "type": "volume_based",
          "discount_percentage": 15,
          "quantity_tier": "50-99"
        }
      ]
    },
    {
      "product_id": "prod_accessories_001",
      "quantity": 10,
      "list_price": 1999,
      "final_price": 1999,
      "unit_discount": 0,
      "total_discount": 0,
      "subtotal": 19990,
      "applied_rules": [],
      "reason_no_discount": "category_not_eligible"
    }
  ],
  "summary": {
    "total_list_price": 769915,
    "total_discount": 112500,
    "total_final_price": 657415,
    "discount_percentage": 14.6,
    "currency": "USD"
  },
  "rules_considered": 3,
  "rules_applied": 1,
  "calculation_timestamp": "2024-06-20T16:30:00Z"
}