Setting Prices for Charging

Learn how to set prices for EV charging.

Rates allow you to set a price for charging sessions on a connector. By setting a Rate, eDRV will automatically calculate and report costs for an ongoing session via Webhook events in the session.cost property so your application does not have to.

You can currently set rates on a connector as a combination of any of the following three elements:

  • ENERGY : energy delivered
  • TIME : energy consumption period
  • FLAT : a flat fee
    See Rates for further details.

Rates are also used for eDRV's Charging Intelligence for e.g. if you want to set a cap on costs for a charging session.

Please see the Coming Soon section for more Complex Rates such as:

  • Time of Day Rates: For example daytime vs. night time rates.
  • Overstay Rates: To encourage drivers to vacate chargestations as soon as possible after a full charge.
  • Rates by User Groups: Give VIPs and loyal customers special rates.

Prerequisites

  1. Have an API token and verified it is working for you. See Token Request
  2. Get Connector Id. Rates are attached to a connector

    You can get this by calling the GET /chargestations endpoint.

Step 1: Create a Rate

const request = require('request');

const options = {
  method: 'POST',
  url: 'https://api.edrv.io/v1.1/rates',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
    Authorization: 'Bearer eDRV_TOKEN'
  },
  body: {
    price_components: [
      {type: 'FLAT', price: 10.55, tax: 16}, 
      {type: 'ENERGY', price: 0.5, tax: 16}],
    meta_data: {mydata: 'value', mydata2: 'value2'}
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
  /*Save rate Id within your appication*/
  const rate_id = body.result._id;
  
});

Step 2: Attach Rate to a Connector

const connectorId = "5fca57b3fbfcc320b3b03f22";

const options = {
  method: 'PATCH',
  url: 'https://devapi.edrv.io/v1.1/connectors/${connectorId}',
  headers: {Accept: 'application/json', 'Content-Type': 'application/json'},
  body: {rate: rate_id},
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Step 3: Start a new Session

When a new charging session is started on this connector, the attached connector.rate is used to calculate instantaneous session.cost and is reported with every new chargestation energy report to your applicaiton server via Webhooks

See Start Charging on how to start a new charging session.

Complex Rates (Coming Soon)

Time of Day Rates

if you would like to set different prices based on the time of day e.g $0.25/kWh 6Pm - 8Am(night) vs $0.40/kWh 8Am - 6Pm (day).

Overstay Rates

To encourage drivers to move their vehicles, operators will apply a higher rate when the EV has finished charging. eDRV detects when an EV has completed charging and applies the appropriate rate.

Rates by User Groups

Give special rates and connector access to groups of users. E.g. offer special rates to drivers who have a subscription within your app. Or offer VIP drivers access to certain chargestations at a special rate.

eDRV takes a host of signals from the chargestation to accurately measure and report accurate session costs to your application servers even with complex and varying rates.


What’s Next

Learn about Webhooks