Prerequisites

Before implementing plug-and-charge capabilities, ensure you have:

  • Created a Smartcar account and registered your application to obtain your client_id and client_secret.
  • Set up the Smartcar Connect flow to authenticate and authorize users.

For more details, refer to the Getting Started Guide.

How Plug-and-Charge Works

Plug-and-charge allows drivers to initiate charging sessions and handle payments automatically without interacting with external apps or card readers. By integrating with the Smartcar EV Charging API, operators can:

  • Automate billing using vehicle identification data (VIN).
  • Control charging sessions remotely to provide a seamless user experience.

This guide details how to use specific Smartcar API endpoints to implement plug-and-charge functionality for electric vehicles.

API Endpoints for Plug-and-Charge Integration

1. Retrieve VIN

The GET /vin endpoint helps link a vehicle to the driver’s account for billing by returning the unique vehicle identification number, used for identifying and authenticating vehicles during plug-and-charge.

VIN
GET /vehicles/{vehicle_id}/vin
Example Response
{
    "vin" : "2SCTESLFHL4SB3S9S"
}

2. Retrieve Battery State of Charge (SoC)

You can retrieve the current battery level and range through the GET /battery endpoint. The battery’s state of charge is essential for calculating energy consumption during charging.

Range Remaining and SoC
GET /vehicles/{vehicle_id}/battery
Example Response
{
    "percentRemaining": 0.3,
    "range": 40.5
}

3. Remote Start and Stop Charging

Use the POST /charge endpoint to initiate and end charging sessions remotely.

Start charge
POST /vehicles/{vehicle_id}/charge
    {
        "action" : "START"
    }
Example Response
{
    "message" : "success"
}

Implementation Workflow

1.Authorize Vehicle Access:

Ensure the vehicle is authenticated through the Smartcar Connect flow to allow API access.

2.Check Battery State:

Retrieve the state of charge (SoC) using GET /battery to determine the current battery level. This ensures that charging sessions start when necessary, and it allows for accurate tracking of energy consumption from the beginning of the session.

3.Identify Vehicle

Retrieve the VIN using GET /vin to identify the vehicle and link it with the driver’s account for billing.

4.Initiate Charging

Start the charging process remotely using POST /charge/start. The vehicle’s VIN will be used for billing.

5.Monitor Charging Session

Retrieve the state of charge with GET /battery to monitor energy consumption during the session.

6.Stop Charging

End the session with POST /charge/stop once the desired energy level is reached or based on scheduled requirements.

Best Practices

  • Link VIN to Payment Account: Always ensure that the VIN is associated with a valid payment account before initiating plug-and-charge.
  • Monitor SoC Continuously: Regularly monitor the battery’s SOC to determine the energy consumed during charging, ensuring accurate billing.
  • Use Secure API Calls: Ensure secure authentication for requests to restrict charging control to authorized users only.

FAQs

Was this page helpful?