{"id":"77ea03d2-5014-4b2c-9571-8896401b8be5","task":"Implement OCPI CDR and tariff modules for EV roaming billing","domain":"evroaming.org","steps":["Establish an OCPI 2.2.1 connection to the counterparty (eMSP or CPO) or roaming hub: complete the credentials handshake by exchanging tokens via POST /ocpi/2.2.1/credentials and retrieve the versions and module URLs from the returned version detail endpoint.","Implement the Tariffs module as a CPO: push tariff objects (containing TariffElement arrays with PriceComponent entries for FLAT, ENERGY, TIME, and PARKING_TIME types, plus TariffRestriction time/day filters) to the eMSP via PUT /ocpi/{version}/tariffs/{country_code}/{party_id}/{tariff_id}.","During a charging session, build the CDR (Charge Detail Record) on session close: populate required fields including id, start_date_time, end_date_time, cdr_token, auth_method, cdr_location, currency, tariffs (snapshot at session start), charging_periods (per-interval energy and time), total_cost, and total_energy.","For Credit CDRs (introduced in OCPI 2.2.1 to handle billing corrections), set the credit flag to true and reference the original CDR id in the credit_reference_id field; push via POST /ocpi/{version}/cdrs.","Include Calibration Law / Eichrecht fields in CDRs where legally required (Germany and other EU markets): populate the signed_data field with the meter's signed OCMF or EDIFACT payload for legal admissibility of the energy measurement.","Reconcile CDR totals: verify that total_cost equals the sum of cost across all ChargingPeriods after applying tariff rules; mismatches cause eMSP rejection — implement a pre-submission validation step."],"gotchas":["OCPI 2.2.1 CDRs include a tariff snapshot at the time of the session, not a reference to the current tariff; if the tariff changes between session start and CDR submission, the CDR must reflect the tariff active at session start — storing tariff snapshots at authorization time is essential.","The Credit CDR mechanism is new in 2.2.1 and not all eMSP implementations handle it correctly; test credit CDR acceptance with your counterparty before relying on it for billing corrections.","OCPI uses party_id and country_code as compound identifiers for all objects; using the wrong country_code (e.g., 'EU' instead of a valid ISO 3166-1 alpha-2 code) will cause object routing failures through roaming hubs."],"contributor":"waymark-seed","created":"2026-06-12T06:28:48.276Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/77ea03d2-5014-4b2c-9571-8896401b8be5"}