Skip to main content
Receive Drive API CDR forwarding webhooks, handle retries idempotently, and process completed charging session records.
⚠️ CDR forwarding is only available when Plugsurfing does not clear the charging session. When Plugsurfing is the acting payment provider, the session is used as a record of the charging session.

Introduction

A CDR (Charging Detail Record) contains information about a completed charging session. Overall, they contain the following information:
  • Who: user or charging key information
  • What: details on the charging session, including cost details
  • Where: location details
CDRs are sent to you using webhooks. For a webhook overview (including security and HMAC), start with Webhooks.

CDRs on Drive API

  • Requests will be sent as HTTP POST
  • The client should return a 200 response when the request is accepted
  • The client should return a 400 response when the request is not valid
  • The client should return a 403 response if authorization failed (see Configuration section below)
  • The client should return a 500 response in case it fails
  • We expect a response within 5 seconds. Any processing that can lead to response times higher than 5 seconds should be done asynchronously
  • New fields might be added to the schema without prior notice. Ensure that unknown fields are ignored and do not result in errors.

Retry logic

If the client doesn’t respond with 200 or doesn’t respond in time, the request will be retried: the CDR will be resent every night for 7 days (both on stage and prod environments).

Idempotency Expectation

For reliability, each webhook request includes a unique requestId that remains the same across all retry attempts. Therefore, your system should handle webhook events idempotently. This means:
  • Ensure your system processes each event only once even if you receive the same requestId multiple times due to retries.
  • Return a200 response as soon as you have successfully processed the event or stored it for later processing.

Example Scenario:

  • We send a request to your endpoint, your system experiences a delay and does not return a response in time so we mark it as failed, but your system eventually manages to process it.
  • We will resend the same event again later, including the same requestId. At that point, we expect your system to recognize that this event has already been processed, so you should return a 200 response.
Handling retries idempotently helps avoid duplicate processing, ensuring consistent behavior across webhook interactions.

Configuration

Here is what we need to configure the CDR webhook:
  • URL to which we will send the CDRs
  • Authorization headers that will be passed in the request to the mentioned URL
Please contact your account manager with this data, so that we can set it up.

CDR Data

Payer Model

There are two possible Payer models depending on the integration:

User Model

See User model example for a sample JSON payload.

Charging Key Model

See Charging key model example for a sample JSON payload.

Item

Session

Location
GeoCoordinates
Cost
CostSegment
Minor units
Minor units are the smallest subdivisions of each currency.
Here are the specifications for handling costs in various currencies:
For more information, check minor units explanation.
HomeCharging
Unit
Describes what quantity in PriceElement refers to. For ENERGY, FLAT, and CAPPED the Unit does not change, but for TIME, PARKING_TIME, and CONGESTION_TIME it can differ. segmentCostMinorUnitsInclVat contains the total price for this segment.
It’s calculated as quantity * pricePerUnitMinorUnitsInclVat.
In the example below, the user charged over one hour. With a step size of one hour (60 minutes), this results in a quantity of two ‘steps’. See Prices for more details on how step size works. Example PriceElement
In the priceElements array the same type might show up multiple times (example: the price is 1 EUR/min from 00:00 to 12:00 and 0.5 EUR/min from 12:00 to 00:00, and the session lasted from 11:30 till 13:00. The CDR will contain two TIME cost segments).

Examples

User model example

Charging key model example

Security

If you want to be sure that CDRs you receive are emitted by Plugsurfing, please check the Verify HMAC Signatures guide.