docs
  1. Scayle Developer Guides
  2. Transactions & Orders
  3. General
  4. Price Calculator V1

Price Calculator v1

The Price Calculator (PC) is a centralized library used by our Order Management System (ORM) to compute all pricing-related information, including taxes, discounts, and unit pricing. This service standardizes price calculations across invoices, API responses, webhooks, and all parts of the customer order journey.

⚙️ PC can be enabled or disabled at the app/tenant level via Tenant Configuration. Once enabled for an order, the same Price Calculator will be used consistently for all subsequent order steps.

🔍 Key Principles

1. Product Line-Based Tax Calculation

  • Taxes are calculated on the product line level, not per item.
  • If a product has a quantity >1, the total tax is computed on the combined line price.
    • This ensures a consistent tax model throughout the order lifecycle.

2. Tax Summary Calculation

  • The tax summary displayed on invoices is the sum of rounded taxes from each product line.
  • Calculation steps:
    1. Calculate tax and net amounts per product line using the product's tax rate.
    2. Round each tax amount to two decimal places.
    3. Sum the rounded tax values to form the total tax summary.

Example:

If an order has 3 products (A, B and C) and each one of them with the following tax amount:

Tax amount A: 0,513
Tax amount B: 0,414
Tax amount C: 0,294

Price Calculator v1  - will first round the tax amount individually and then sum the rounded amounts:

Tax amount A rounded: 0,51
Tax amount B rounded: 0,41
Tax amount C rounded: 0,29
Total Tax: 1,21

deprecated Price Calculator - was summing the unrounded tax amounts and then rouding the final result:

Sum of unrounded amounts: 1,221
Total Tax: 1,22

3. Absolute Vouchers Handling

  • Absolute vouchers apply at order level in the Checkout UI.
  • However, for invoices and refunds, the discount is applied to a single item (typically the most expensive eligible item).
  • Before confirmation: product prices do not reflect the voucher.
  • After confirmation: invoices show the discount as part of the item price.

4. Unit-Level Item Pricing

  • Unit-level prices are now exposed for individual items.
  • This allows for advanced promotions like “buy 5, get 1 free” (e.g., 4 shirts at full price, 1 at €0).
  • Tax is still calculated at line level, but unit prices are displayed separately.
  • Small rounding differences (1–2 cents) between unit-level and total pricing are expected and accepted by PSPs.

🔄 Impacted Areas

📄 Invoices

The following fields may have 1–2 cent differences compared to the deprecated Price Calculator (before Price Calculator v1):

  • totals.undiscounted
  • totals.before
  • totals.after
  • totals.difference
  • totals.before.taxSummary
  • totals.bruttoDiscount
  • totals.bruttoWithServiceCosts
  • totals.netto
  • totals.nettoWithServiceCosts
  • totals.tax
  • totals.taxWithServiceCosts

📦 GET Order API

Small differences (1–2 cents) may be observed in:

  • totals.costWithoutTaxWithoutAbsoluteVouchersWithServiceCosts
  • totals.costWithoutTaxWithVouchersWithServiceCosts
  • totals.costWithoutTaxWithVouchersWithShipping

Note: No changes are expected to brutto (gross) prices. Only net values and tax amounts may vary slightly due to rounding changes.

Also affected at the item level:

  • items.available.total.taxAmount
  • items.available.unit.costWithoutTaxWithMembershipDiscount
  • items.available.unit.costWithoutTaxWithVoucher
  • items.available.unit.costWithoutTaxWithoutVoucher
  • items.available.unit.taxWithVoucher
  • items.available.unit.taxWithoutVoucher

☁️ Webhooks & Cloud API

Small value differences may occur in:

  • cost.withoutTax
  • cost.withoutTaxwithMembershipDiscount
  • cost.vat.amount.amount

💬 CCI (Customer Care Interface)

The following fields may also show rounding differences:

  • item.withoutTaxWithMembershipDiscount
  • items.cost.withoutTaxWithMembershipDiscount

📌 Key Notes

  • Rounding behavior in Price Calculator v1 follows “round per product line, then sum” logic.
  • Price Calculator behavior is consistent across all steps of the order journey.
    • If an order is created using deprecated Price Calculator, the same will be used for all calculations till the end.
  • Developers integrating with the API should account for minor tax and net price differences due to improved rounding methodology.
  • Gross prices remain unaffected.