OCPP 2.0.1 Edition 4

Tariff and Cost Flows - CSMS Developer Guide

Based on OCPP 2.0.1 Edition 4 Specification (Part 2, Section I). This guide covers all tariff and cost flows from the CSMS perspective, including tariff display, running cost updates, and fallback messaging.

7 Sections
6 Use Cases
I01 - I06

1. Overview

Introduction

The Tariff and Cost functional block provides tariff and cost information to an EV Driver, when a Charging Station is capable of displaying this on a screen/display. The CSMS is responsible for central cost calculation — the Charging Station only displays what it receives.

Key Concepts

No Structured Tariff Data

OCPP deliberately does not define a structured tariff format. Tariff structures can be very complex. Instead, the CSMS provides human-readable text messages via personalMessage / updatedPersonalMessage fields.

Central Cost Calculation

The CSMS is responsible for all cost calculations. The Charging Station only displays what it receives from the CSMS. The CSO (Charging Station Operator) owns the tariffs.

Currency Configuration

All tariffs and costs use the currency configured in the Configuration Variable Currency (e.g., "EUR", "USD") on the TariffCostCtrlr component.

Display Support Required

The Charging Station needs to support the Tariff Information or DisplayMessage functionality to show tariff and cost data to the EV Driver.

Flow Summary

Flow Name Direction When CSMS Role
I01 Show EV Driver-specific Tariff CS <-> CSMS Before transaction (AuthorizeRequest) Return tariff in personalMessage
I02 Running Total Cost During Charging CSMS -> CS During transaction (periodic) Send CostUpdatedRequest or include totalCost
I03 Final Total Cost After Charging CS <-> CSMS Transaction ends Return totalCost in TransactionEventResponse
I04 Fallback Tariff Information Local on CS CS offline / no tariff Configure TariffFallbackMessage variable
I05 Fallback Total Cost Message Local on CS CS offline at stop Configure TotalCostFallbackMessage variable
I06 Update Tariff During Transaction CS <-> CSMS During transaction Return updatedPersonalMessage

2. OCPP Messages Used in Tariff & Cost Flows

Protocol

2.1 Messages Where CSMS Receives a Request (CS -> CSMS)

Charging Station --> CSMS
Message Action String Used In Flows
AuthorizeRequest "Authorize" I01
TransactionEventRequest "TransactionEvent" I02, I03, I06

2.2 Messages Where CSMS Sends a Request (CSMS -> CS)

CSMS --> Charging Station
Message Action String Used In Flows
CostUpdatedRequest "CostUpdated" I02
SetVariablesRequest "SetVariables" I04, I05 (configuration)

3. Key Data Types & Schemas

Reference

3.1 Rust Imports (rust-ocpp v2.0.0)

Key imports needed for implementing tariff and cost flows in the CSMS.

Key Rust Imports
// For I01 (AuthorizeResponse with tariff info)
use rust_ocpp::v2_0_1::messages::authorize::{AuthorizeRequest, AuthorizeResponse};

// For I02 (CostUpdated)
use rust_ocpp::v2_0_1::messages::cost_updated::{CostUpdatedRequest, CostUpdatedResponse};

// For I02, I03, I06 (TransactionEvent with cost)
use rust_ocpp::v2_0_1::messages::transaction_event::{
    TransactionEventRequest, TransactionEventResponse,
};

// For I04, I05 (SetVariables configuration)
use rust_ocpp::v2_0_1::messages::set_variables::{SetVariablesRequest, SetVariablesResponse};

// Shared types
use rust_ocpp::v2_0_1::datatypes::{
    IdTokenInfoType,
    MessageContentType,
    MessageFormatEnumType,
};

3.2 MessageContentType

Used for all human-readable messages in tariff flows. This is the core type for delivering tariff and cost information to the EV Driver.

MessageContentType Schema
{
  "format": "MessageFormatEnumType",    // REQUIRED: ASCII, HTML, URI, UTF8
  "language": "string (max 8)",         // optional, RFC 5646 language code
  "content": "string (max 512)"         // REQUIRED, the message text
}
Field Type Required Description
format MessageFormatEnumType Yes ASCII, HTML, URI, or UTF8
language string (max 8) No RFC 5646 language code (e.g., "en", "de")
content string (max 512) Yes The human-readable message text

3.3 MessageFormatEnumType

Specifies the format of the message content.

Value Description
ASCII Plain ASCII text
HTML HTML formatted text
URI URI pointing to external content
UTF8 UTF-8 encoded text (most common for multi-language support)

4. Configuration Variables

Config

These Charging Station configuration variables are relevant to tariff and cost flows. The CSMS can set them via SetVariablesRequest.

TariffCostCtrlr Component

Variable Component Description
Currency TariffCostCtrlr ISO 4217 currency code (e.g., "EUR", "USD"). All cost values use this currency.
TariffFallbackMessage TariffCostCtrlr Fallback tariff text displayed when CS is offline or no specific tariff is available (I04).
TotalCostFallbackMessage TariffCostCtrlr Fallback message displayed instead of total cost when CS is offline at transaction end (I05).

Setting Configuration Variables (CSMS -> CS)

To configure fallback messages, the CSMS sends a SetVariablesRequest:

SetVariablesRequest - Configure Tariff Variables
[2, "msg-001", "SetVariables", {
  "setVariableData": [
    {
      "attributeType": "Actual",
      "attributeValue": "EUR",
      "component": { "name": "TariffCostCtrlr" },
      "variable": { "name": "Currency" }
    },
    {
      "attributeType": "Actual",
      "attributeValue": "Charging costs 0.30 EUR/kWh. Final cost will be shown after charging.",
      "component": { "name": "TariffCostCtrlr" },
      "variable": { "name": "TariffFallbackMessage" }
    },
    {
      "attributeType": "Actual",
      "attributeValue": "Total cost will be sent to your account. Check your app for details.",
      "component": { "name": "TariffCostCtrlr" },
      "variable": { "name": "TotalCostFallbackMessage" }
    }
  ]
}]

5. Tariff & Cost Flows

Use Cases I01-I06
I01

Show EV Driver-specific Tariff Information

Show an EV Driver-specific tariff before the start of a transaction, so the driver knows how much charging will cost.

Actors: Charging Station, CSMS, EV Driver

Prerequisites: The Charging Station supports Tariff Information and uses central cost calculation by CSMS. No ongoing transaction for this user.

Sequence Diagram:

EV Driver          Charging Station              CSMS
   |                     |                         |
   |--present IdToken--->|                         |
   |                     |---AuthorizeRequest----->|
   |                     |    (idToken)            |
   |                     |                         |  Look up tariff for
   |                     |                         |  this IdToken/driver
   |                     |<--AuthorizeResponse-----|
   |                     |    status=Accepted      |
   |                     |    personalMessage=     |
   |                     |    "0.25/kWh"           |
   |<--show tariff-------|                         |
   |   "0.25/kWh"        |                         |

CSMS Handling:

  1. Authorize the IdToken as usual (check validity, status, etc.)
  2. Look up the applicable tariff for this specific EV Driver / IdToken at this Charging Station
  3. Include the tariff information in the personalMessage field of IdTokenInfoType in the AuthorizeResponse

AuthorizeRequest (CS -> CSMS):

Field Type Required Description
idToken IdTokenType Yes The token to authorize
certificate string No X.509 certificate (ISO 15118)
iso15118CertificateHashData OCSPRequestDataType[] No OCSP data for certificate validation

AuthorizeResponse — IdTokenInfoType (key fields for tariff delivery):

Field Type Required Description
status AuthorizationStatusEnumType Yes Accepted, Blocked, Expired, Invalid, etc.
personalMessage MessageContentType No Tariff information text to display to EV Driver
cacheExpiryDateTime dateTime No Cache expiry for this authorization
chargingPriority integer No Priority (-9 to 9, default 0)
language1 string (max 8) No Preferred language (RFC 5646)
language2 string (max 8) No Second preferred language
evseId integer[] No Restrict token to specific EVSEs
groupIdToken IdTokenType No Associated group token
Example AuthorizeResponse with Tariff
[3, "msg-authorize-123", {
  "idTokenInfo": {
    "status": "Accepted",
    "personalMessage": {
      "format": "UTF8",
      "language": "en",
      "content": "Tariff: 0.25 EUR/kWh + 0.02 EUR/min after 60 min"
    }
  }
}]

Requirements (CSMS Perspective):

ID Requirement
I01.FR.01 The CSMS MAY send EV Driver-specific tariff information in the idTokenInfo.personalMessage field of an AuthorizeResponse message
I01.FR.02 The CSMS SHALL only send the tariff information if the Charging Station supports the tariff or DisplayMessage functionality

Implementation Notes:

  • The tariff information presented might be the same for all tokens
  • If known, show tariff in the EV Driver's preferred language (use language1/language2 from previous IdTokenInfoType data)
  • Give the driver the option to cancel (e.g., not plugging in the cable)
  • If the AuthorizeResponse status is not Accepted, the EV Driver cannot start and might not see the tariff
  • Alternative flow: If no specific tariff is available, fall back to I04 (Fallback Tariff Information)
I02

Show EV Driver Running Total Cost During Charging

Show the EV Driver the running total cost during an ongoing transaction, updated at regular intervals.

Actors: Charging Station, CSMS, EV Driver

Prerequisites: The Charging Station supports Tariff Information. Ongoing transaction using central cost calculation by CSMS.

Method 1: CostUpdatedRequest (CSMS -> CS)

The CSMS proactively sends cost updates to the Charging Station at regular intervals.

Sequence Diagram:

CSMS                    Charging Station         EV Driver
  |                           |                      |
  |  [while transaction ongoing, every Y seconds]    |
  |                           |                      |
  |---CostUpdatedRequest----->|                      |
  |   transactionId="tx-001"  |                      |
  |   totalCost=3.75          |                      |
  |                           |                      |
  |<--CostUpdatedResponse-----|                      |
  |   (empty body)            |---show cost: 3.75--->|
  |                           |                      |

CostUpdatedRequest:

Field Type Required Description
totalCost number Yes Current total cost of the transaction including taxes, in the configured Currency
transactionId string (max 36) Yes Transaction ID to update cost for

CostUpdatedResponse:

Empty object {} — no fields.

CostUpdatedRequest
[2, "cost-update-001", "CostUpdated", {
  "totalCost": 3.75,
  "transactionId": "tx-abc-123"
}]
CostUpdatedResponse
[3, "cost-update-001", {}]

Method 2: TransactionEventResponse with totalCost

When the CS sends a TransactionEventRequest with eventType=Updated, the CSMS can include the running cost in the response.

Sequence Diagram:

Charging Station              CSMS
      |                         |
      |---TransactionEvent----->|
      |   eventType=Updated     |
      |   meterValue=[...]      |
      |                         | Calculate running cost
      |<--TransactionEvent------|   based on meter values
      |   Response              |
      |   totalCost=3.75        |
      |                         |

TransactionEventResponse (relevant fields):

Field Type Required Description
totalCost number No Current running total cost or final cost. In configured Currency.
idTokenInfo IdTokenInfoType No Updated authorization info
updatedPersonalMessage MessageContentType No Updated message (for tariff updates, see I06)
chargingPriority integer No Temporary priority override (-9 to 9)

Important: The totalCost field in TransactionEventResponse is described in the JSON schema as "SHALL only be sent when charging has ended." However, the specification I02.FR.01 states the CSMS SHALL return the running cost in a TransactionEventResponse. In practice, many implementations use CostUpdatedRequest (Method 1) for running cost and reserve totalCost for the final cost at transaction end (I03).

Requirements (CSMS Perspective):

ID Requirement
I02.FR.01 The CSMS SHALL send either a CostUpdatedRequest at a relevant interval/moment or return the running cost in a TransactionEventResponse
I02.FR.02 Upon receipt of a CostUpdatedRequest, the CS SHALL respond with a CostUpdatedResponse
I02.FR.03 The CS SHALL show the current total cost to the EV Driver
I02.FR.04 When running cost is reported in TransactionEventResponse, the CS SHALL show the current running cost to the EV Driver

Implementation Notes:

  • Update frequency: Balance between responsiveness and efficiency (e.g., every 30-60 seconds for DC fast charging, every 5-10 minutes for slow AC charging)
  • The CSMS needs to track active transactions and know which Charging Stations are connected to send CostUpdatedRequest messages
  • The CostUpdatedRequest is sent via the WebSocket connection — the CSMS must use the ConnectionManager to find the active connection
  • The cost should include taxes

CSMS Implementation Steps:

  1. When a transaction starts (receive TransactionEventRequest with eventType=Started), begin tracking the transaction
  2. Periodically (or on each TransactionEventRequest with eventType=Updated):
    1. Calculate the running total cost based on meter values and the applicable tariff
    2. Send a CostUpdatedRequest with the updated totalCost and transactionId
  3. Receive the CostUpdatedResponse (empty body, no action needed)
I03

Show EV Driver Final Total Cost After Charging

Show the EV Driver the final total cost of the transaction after charging has ended.

Actors: Charging Station, CSMS, EV Driver

Prerequisites: The Charging Station supports Tariff Information. Ongoing transaction using central cost calculation by CSMS.

Sequence Diagram:

EV Driver          Charging Station              CSMS
   |                     |                         |
   |--present IdToken--->|  (stop transaction)     |
   |                     |                         |
   |                     |---TransactionEvent------>|
   |                     |   eventType=Ended        |
   |                     |   meterValue=[...]       |
   |                     |                         |  Calculate final
   |                     |                         |  total cost
   |                     |<--TransactionEvent-------|
   |                     |   Response               |
   |                     |   totalCost=12.50        |
   |<--show cost---------|                         |
   |   "Total: 12.50 EUR"|                         |

CSMS Handling:

  1. Calculate the final total cost of the transaction based on all meter values and the applicable tariff
  2. Include totalCost in the TransactionEventResponse
  3. The Charging Station displays the total cost to the EV Driver

TransactionEventRequest (CS -> CSMS) — eventType=Ended:

Field Type Required Description
eventType TransactionEventEnumType Yes "Ended"
timestamp dateTime Yes When the event occurred
triggerReason TriggerReasonEnumType Yes Why the transaction ended (e.g., StopAuthorized, EVDisconnected, Remote)
seqNo integer Yes Sequence number
transactionInfo TransactionType Yes Contains transactionId and stoppedReason
meterValue MeterValueType[] No Final meter readings
idToken IdTokenType No Token that stopped the transaction
evse EVSEType No EVSE where transaction occurred
offline boolean No Whether the CS was offline (default: false)

TransactionEventResponse (CSMS -> CS) — with Final Cost:

Field Type Required Description
totalCost number No Final total cost including taxes. 0.00 = free. Omitted = not free (cost unknown or not computed yet).
idTokenInfo IdTokenInfoType No Updated authorization info
updatedPersonalMessage MessageContentType No Additional message to display
chargingPriority integer No Temporary priority override
TransactionEventResponse with Final Cost
[3, "tx-end-msg-001", {
  "totalCost": 12.50,
  "idTokenInfo": {
    "status": "Accepted"
  }
}]
Free Transaction
[3, "tx-end-msg-002", {
  "totalCost": 0.00
}]

Requirements (CSMS Perspective):

ID Requirement
I03.FR.01 When transaction is stopped, the CS SHALL send a TransactionEventRequest (eventType=Ended) to the CSMS
I03.FR.02 When Total Cost is known, the CSMS SHALL send the total cost in the totalCost field of the TransactionEventResponse
I03.FR.03 If CS was online when transaction stopped, the CS SHALL display the total cost to the EV Driver
I03.FR.04 To indicate a free transaction, the CSMS SHALL set totalCost to 0.00. Omitting totalCost does NOT imply free
I03.FR.05 If TxStopPoint is ParkingBayOccupancy, the CS SHOULD NOT display the total cost (driver has left)

Implementation Notes:

  • If the CS was offline when the transaction ended, the TransactionEventRequest with the totalCost in the response will arrive when the CS comes back online — by then the driver has likely left
  • The alternative scenario for when the CS is offline at transaction end is I05 (Show Fallback Total Cost Message)
  • totalCost omitted does not equal free. Always set totalCost: 0.00 explicitly for free transactions
I04

Show Fallback Tariff Information

Show a generic fallback tariff message when the CS cannot get a specific EV Driver tariff (e.g., CS is offline, or no driver-specific tariff is available).

Actors: Charging Station, EV Driver (CSMS configures only)

Prerequisites: The Charging Station supports Tariff Information. The Configuration Variable TariffFallbackMessage is configured.

Sequence Diagram:

EV Driver          Charging Station              CSMS
   |                     |                         |
   |--present IdToken--->|                         |
   |                     |                         |
   |              [CS is offline]                  |
   |                     |--check auth cache-->    |
   |                     |<---authorized------     |
   |<--TariffFallback----|                         |
   |   Message           |                         |
   |                     |                         |
   --- OR ---
   |                     |                         |
   |              [No specific tariff available]   |
   |                     |---AuthorizeRequest----->|
   |                     |<--AuthorizeResponse-----|
   |                     |   (no personalMessage)  |
   |<--TariffFallback----|                         |
   |   Message           |                         |

CSMS Handling:

The CSMS role in I04 is configuration only — it configures the TariffFallbackMessage on the Charging Station via SetVariablesRequest during provisioning or when tariffs change.

When to send the fallback tariff variable:

  1. During initial Charging Station provisioning (after BootNotification)
  2. When tariff information changes
SetVariablesRequest — Configure TariffFallbackMessage
[2, "set-tariff-fallback", "SetVariables", {
  "setVariableData": [
    {
      "attributeType": "Actual",
      "attributeValue": "Standard rate: 0.30 EUR/kWh. Check our website for detailed pricing.",
      "component": { "name": "TariffCostCtrlr" },
      "variable": { "name": "TariffFallbackMessage" }
    }
  ]
}]

Requirements (CSMS Perspective):

ID Requirement
I04.FR.01 When the CS cannot get a specific tariff for the EV Driver, the CS SHALL display the fallback tariff message configured in TariffFallbackMessage
I04.FR.02 The CSMS MAY configure the TariffFallbackMessage via the Configuration Variable TariffFallbackMessage

Implementation Notes:

  • This is the alternative scenario for I01 — when no specific tariff can be delivered
  • The fallback message is stored locally on the Charging Station, so it works even when offline
  • Keep the fallback message informative but generic (e.g., "Standard rate: X.XX EUR/kWh")
I05

Show Fallback Total Cost Message

Show a fallback message instead of the actual total cost when the CS is offline at the time the transaction stops.

Actors: Charging Station, EV Driver (CSMS configures only)

Prerequisites: The Charging Station supports Tariff Information. The CS is offline. The Configuration Variable TotalCostFallbackMessage is configured.

Sequence Diagram:

EV Driver          Charging Station
   |                     |
   |   [Ongoing transaction, CS is OFFLINE]
   |                     |
   |--present IdToken--->|
   |                     |--stop energy
   |                     |  offer
   |                     |--unlock
   |                     |  connector
   |                     |
   |<--TotalCostFallback-|
   |   Message           |

CSMS Handling:

The CSMS role in I05 is configuration only — it configures the TotalCostFallbackMessage on the Charging Station via SetVariablesRequest.

SetVariablesRequest — Configure TotalCostFallbackMessage
[2, "set-cost-fallback", "SetVariables", {
  "setVariableData": [
    {
      "attributeType": "Actual",
      "attributeValue": "Total cost will be sent to your registered email. Check our app for details.",
      "component": { "name": "TariffCostCtrlr" },
      "variable": { "name": "TotalCostFallbackMessage" }
    }
  ]
}]

Requirements (CSMS Perspective):

ID Requirement
I05.FR.01 The CSMS MAY configure the fallback total cost information message via the Configuration Variable TotalCostFallbackMessage
I05.FR.02 When the CS cannot retrieve the total cost because it is offline, the CS SHALL show the fallback total cost message to the EV Driver

Implementation Notes:

  • This is the alternative scenario for I03 — when the CS cannot reach the CSMS to get the final cost
  • The driver still gets informed that their cost will be processed
  • When the CS comes back online and sends the TransactionEventRequest (eventType=Ended), the CSMS should still calculate and return the totalCost — but the driver is likely gone by then
I06

Update Tariff Information During Transaction

Show the EV Driver updated tariff information during an ongoing transaction (e.g., when dynamic pricing changes during DC fast charging).

Actors: Charging Station, CSMS, EV Driver

Prerequisites: The Charging Station supports Tariff Information. There is a transaction ongoing.

Scenario Example: A tariff has a bandwidth: "charging will cost between 0.25 and 0.40 EUR/kWh depending on current energy price. Current price is 0.28 EUR/kWh." When the price changes: "charging will cost between 0.25 and 0.40 EUR/kWh depending on current energy price. Current price is 0.32 EUR/kWh."

Sequence Diagram:

Charging Station              CSMS
      |                         |
      |  [Transaction ongoing]  |
      |                         |
      |---TransactionEvent----->|
      |   eventType=Updated     |
      |   meterValue=[...]      |
      |                         | Check for updated
      |                         | tariff information
      |<--TransactionEvent------|
      |   Response              |
      |   updatedPersonalMessage|
      |   = "New rate: 0.32/kWh"|
      |                         |
      |---show to EV Driver---->|

CSMS Handling:

  1. Check if there is updated tariff information available for this transaction (e.g., dynamic pricing change, time-of-use rate switch)
  2. If yes, include the updated tariff in the updatedPersonalMessage field of the TransactionEventResponse
  3. The Charging Station displays the updated tariff to the EV Driver

TransactionEventResponse — updatedPersonalMessage:

Field Type Required Description
updatedPersonalMessage MessageContentType No Updated tariff information to display to the EV Driver
TransactionEventResponse with Updated Tariff
[3, "tx-update-msg-001", {
  "updatedPersonalMessage": {
    "format": "UTF8",
    "language": "en",
    "content": "Rate updated: 0.32 EUR/kWh (was 0.28 EUR/kWh). Range: 0.25-0.40 EUR/kWh."
  }
}]

Requirements (CSMS Perspective):

ID Requirement
I06.FR.01 When the CSMS receives a TransactionEventRequest (eventType=Updated), the CSMS SHALL check if there is updated tariff information available
I06.FR.02 When there is updated tariff information available, the CSMS SHALL respond with a TransactionEventResponse containing the updated tariff in the updatedPersonalMessage field
I06.FR.03 The CS SHALL display the updated tariff information to the EV Driver

Implementation Notes:

  • There may be a policy or legal requirement that the tariff communicated at the start must be used for the entire transaction — in that case, no updated tariff information should be sent
  • This is primarily useful for dynamic pricing scenarios (e.g., spot market prices for DC fast charging)
  • The updatedPersonalMessage is only sent when there is actually new information — do not send the same message repeatedly

6. Database Schema Considerations

Storage

The CSMS needs database support for storing tariff plans and tracking costs during transactions.

Tariff Storage

Tariff Plans Table
-- Tariff plans associated with locations/charge points
CREATE TABLE tariff_plans (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    location_id UUID NOT NULL REFERENCES locations(id),
    name TEXT NOT NULL,
    currency TEXT NOT NULL DEFAULT 'EUR',          -- ISO 4217
    description TEXT,                               -- Human-readable tariff description
    price_per_kwh NUMERIC,                         -- Base energy price
    price_per_minute NUMERIC,                      -- Time-based pricing
    price_per_session NUMERIC,                     -- Session/start fee
    idle_fee_per_minute NUMERIC,                   -- Idle fee after charging completes
    idle_fee_grace_period_minutes INTEGER,          -- Grace period before idle fee
    valid_from TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    valid_to TIMESTAMPTZ,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
Driver-Specific Tariff Overrides
-- Optional: driver-specific tariff overrides
CREATE TABLE driver_tariff_overrides (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    id_token TEXT NOT NULL,
    id_token_type TEXT NOT NULL,
    tariff_plan_id UUID NOT NULL REFERENCES tariff_plans(id),
    valid_from TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    valid_to TIMESTAMPTZ
);

Cost Tracking During Transactions

Transaction Cost Tracking Columns
-- Add cost tracking columns to existing transactions table
ALTER TABLE transactions ADD COLUMN tariff_plan_id UUID REFERENCES tariff_plans(id);
ALTER TABLE transactions ADD COLUMN total_cost NUMERIC;            -- Final calculated cost
ALTER TABLE transactions ADD COLUMN last_cost_update_at TIMESTAMPTZ; -- When cost was last sent to CS

7. Implementation Checklist

Planning
Phase 1

Core Cost Calculation (I03 - Final Cost)

  • Create tariff plans storage (database table)
  • Implement cost calculation logic based on meter values and tariff plan
  • On TransactionEventRequest (eventType=Ended): calculate and return totalCost in response
  • Handle free transactions explicitly with totalCost: 0.00
  • Store calculated cost in the transactions table
Phase 2

Pre-Charging Tariff Display (I01)

  • Look up applicable tariff for IdToken + Charging Station location
  • Format tariff as human-readable text
  • Include tariff in AuthorizeResponse.idTokenInfo.personalMessage
  • Handle language preferences from IdTokenInfoType
Phase 3

Running Cost Updates (I02)

  • Implement periodic cost update mechanism (e.g., background task per active transaction)
  • Use ConnectionManager to send CostUpdatedRequest via WebSocket
  • Handle CostUpdatedResponse (empty body, just ACK)
  • Configure update interval (balance cost accuracy vs. message traffic)
  • Alternatively/additionally: return running cost in TransactionEventResponse for Updated events
Phase 4

Tariff Updates During Transaction (I06)

  • Track current tariff rate per transaction
  • Detect tariff changes during ongoing transactions
  • Include updatedPersonalMessage in TransactionEventResponse when tariff changes
  • Respect policies that may prohibit mid-transaction tariff changes
Phase 5

Fallback Configuration (I04, I05)

  • During CS provisioning, send SetVariablesRequest to configure: Currency, TariffFallbackMessage, TotalCostFallbackMessage
  • Update fallback messages when tariff plans change

New Message Handler Required

  • CostUpdated handler — This is a CSMS -> CS message (CSMS sends the CALL, CS responds). The CSMS needs to send this via the ConnectionManager, not handle it as an incoming message. Handle the CostUpdatedResponse (CALLRESULT) when it comes back.

Message Routing Updates (ingest.rs)

Outgoing (CSMS -> CS via ConnectionManager):

  • CostUpdatedRequest — new outgoing message type

Incoming (extend existing handlers):

  • AuthorizeRequest — extend to include personalMessage in response
  • TransactionEventRequest — extend to include totalCost and updatedPersonalMessage

OCPP 2.0.1 Tariff and Cost Flows - CSMS Developer Guide. Based on OCPP 2.0.1 Edition 4 Specification (Part 2, Section I, pages 216-224).