CostUpdated

Core CSMS->CS OCPP 2.0.1

Sent by the CSMS to update the running cost of a transaction in real-time, enabling the Charging Station to display the current cost to the driver.

Quick Reference

Required Fields

totalCost number

The current total cost of the transaction (in the currency agreed during provisioning)

transactionId string(36)

ID of the transaction for which the cost is being updated

Example Payload

{
  "totalCost": 4.85,
  "transactionId": "txn-abc123"
}

Example Full Frame

[
  2,
  "msg-001",
  "CostUpdated",
  {
    "totalCost": 4.85,
    "transactionId": "txn-abc123"
  }
]

Format: [MessageType, MessageId, Action, Payload]

Overview

CostUpdated pushes the current transaction cost to the Charging Station during an active session. This enables the station to display live cost information to the driver on its screen.

When to Send

  • Periodically during an active transaction (e.g., every 30 seconds)
  • When the tariff changes during a session (e.g., peak/off-peak transition)
  • At transaction end to show the final cost

Expected Response

Empty response {}.

Usage Notes

  • The currency is determined by bilateral agreement during station provisioning, not in this message
  • totalCost is a cumulative total, not a delta
  • The Charging Station may display this on screen — format is hardware-dependent

Testing Tips

  • Send multiple updates during a session and verify the display updates
  • Send a final update at session end and verify the final cost matches billing records

Common Errors

TypeConstraintViolation

Cause: transactionId is an integer

Solution: transactionId is a string in OCPP 2.0.1

TypeConstraintViolation

Cause: totalCost is a string instead of a number

Solution: totalCost must be a JSON number type