Finishing the charging session

Intermediate

OCPI 2.2.1

Compare this step across versions

Stopping the charge, completing the Session and sending the charge detail record the eMSP bills from.

What happens when you're done charging?

What You'll Learn:
  • How the CPO marks the Session COMPLETED
  • How the CPO sends the charge detail record (CDR)
  • What the eMSP answers
The Players in This Lesson:
CPO
CPO
eMSP
EMSP
Message Flow:
Step 0 of 2
CPO

PATCH /sessions/{country_code}/{party_id}/{session_id}

eMSP

Message: Session update: status COMPLETED

Details: When the Session has finished, the CPO sends the change with PATCH and sets its status to COMPLETED, the final status of a Session. Sessions cannot be deleted.

"Any changes to a Session in the CPO system are sent to the eMSP system by calling PATCH on the eMSP's Sessions endpoint with the updated Session object."OCPI 2.2.1 Sessions module · #mod_sessions_push_model"Sessions cannot be deleted, final status of a session is: `COMPLETED`."OCPI 2.2.1 Sessions module · #mod_sessions_push_model"OCPI status code, as listed in Status Codes, indicates how the request was handled. To avoid confusion with HTTP codes, OCPI status codes consist of four digits."OCPI 2.2.1 Transport and format chapter · #transport_and_format_response_format"|1000 |Generic success code"OCPI 2.2.1 Status codes chapter · #status_codes_1xxx_success
What OCPI 2.2.1 defines for this lesson
Modules in this version
Locations
Sessions
CDRs
Tariffs
Tokens
Commands
Credentials
Hub Client Info
Charging Profiles
Payments
Bookings
Advertised sender and receiver interfaces

An endpoint declares how another platform can pull or push data. Credentials uses the same interface for both roles.

The header token is encoded

The request header carries an encoded token; the Credentials body still carries the raw token.

Billing records name the Token owner

A charge record names the country and company that own the driver's Token.