> ## Documentation Index
> Fetch the complete documentation index at: https://smartcar.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Enabling simplified payments

> This guide outlines how charge point operators can utilize the Smartcar API to implement plug-and-charge capabilities, enabling automatic billing and session management through vehicle identification and charging data.

## 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.

<Tip>
  For more details, refer to the [Getting Started Guide](https://smartcar.com/docs/getting-started/).
</Tip>

## 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](/api-reference/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.

```bash VIN theme={null}
GET /vehicles/{vehicle_id}/vin
```

```json Example Response theme={null}
{
    "vin" : "2SCTESLFHL4SB3S9S"
}
```

### 2. Retrieve Battery State of Charge (SoC)

You can retrieve the current battery level and range through
the [GET /battery](/api-reference/evs/get-battery-level) endpoint. The battery’s
state of charge is essential for calculating energy consumption during charging.

```bash Range Remaining and SoC theme={null}
GET /vehicles/{vehicle_id}/battery
```

```json Example Response theme={null}
{
    "percentRemaining": 0.3,
    "range": 40.5
}
```

### 3. Remote Start and Stop Charging

Use the [POST /charge](/api-reference/evs/control-charge) endpoint to initiate
and end charging sessions remotely.

<Tabs>
  <Tab title="Start Charging">
    ```bash Start charge theme={null}
    POST /vehicles/{vehicle_id}/charge
        {
            "action" : "START"
        }
    ```

    ```json Example Response theme={null}
    {
        "message" : "success"
    }
    ```
  </Tab>

  <Tab title="Stop Charging">
    ```bash Stop charge theme={null}
    POST /vehicles/{vehicle_id}/charge
        {
            "action" : "STOP"
        }
    ```

    ```json Example Response theme={null}
    {
        "message" : "success"
    }
    ```
  </Tab>
</Tabs>

## 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

<AccordionGroup>
  <Accordion title="How does Smartcar enable billing for plug-and-charge?">
    The VIN retrieved through the Smartcar API is linked to the driver’s
    payment account, enabling automatic billing based on energy consumption
    during charging sessions.
  </Accordion>

  <Accordion title="Which vehicles are compatible with Smartcar’s plug-and-charge?">
    Smartcar supports over 200 EV models across North America and Europe. For a complete list, refer to the [Smartcar Compatibility Matrix](https://smartcar.com/product/compatible-vehicles).
  </Accordion>

  <Accordion title="Is the plug-and-charge solution charger-agnostic?">
    Yes, Smartcar’s API enables integration with any charging station network by
    providing vehicle data through our platform.
  </Accordion>
</AccordionGroup>
