Skip to main content
This guide walks through building a dynamic pricing system that calculates discounts, applies promotions, and determines final prices based on customer and order data.

What you’ll build

A pricing decision that:
  • Applies tiered discounts based on customer loyalty level
  • Adds volume discounts for large orders
  • Stacks promotional codes
  • Calculates final price with all adjustments
Want to skip ahead? Download the completed decision and import it directly.

Decision flow

Example input

{
  "customer": {
    "tier": "gold",
    "yearsActive": 3
  },
  "order": {
    "subtotal": 450,
    "itemCount": 12
  },
  "promoCode": "SUMMER20"
}

Step 1: Customer tier discounts

Create a decision table for base discounts by customer tier:
Inputs
Outputs
Logic:
  • Platinum customers always get 20%
  • Gold customers get 15% after 3 years, 12% before
  • Silver customers get 10% after 2 years, 8% before
  • Everyone else gets 5%

Step 2: Volume discounts

Add another decision table for quantity-based discounts:
Inputs
Outputs

Step 3: Promotional codes

Handle promo codes with another table:
Inputs
Outputs

Step 4: Calculate final price

Use an expression node to combine all discounts:
Key logic:
  • Calculate savings from each discount type
  • Cap total discount at 40% to protect margins
  • Round to 2 decimal places

Testing scenarios

ScenarioExpected result
Gold customer, 3+ years, 12 items, no promo15% tier + 5% volume = 20% off
New customer, 5 items, NEWUSER code5% tier + 15% promo = 20% off
Platinum, 50 items, SUMMER20Capped at 40% (would be 50%)

Output structure

{
  "baseAmount": 450,
  "tierSavings": 67.50,
  "volumeSavings": 22.50,
  "promoSavings": 90,
  "totalDiscount": 180,
  "finalPrice": 270
}

Variations

Time-based pricing

Add date conditions for seasonal pricing:
Inputs
Outputs

Geographic pricing

Adjust by region:
Inputs
Outputs