# PayGo Dash Merchant API Documentation

## **PayGo Dash Merchant API Documentation**

**Swagger Reference:** <https://api.paygodash.com/docs/api-merchants>

***

### **Introduction**

The **PayGo Dash Merchant API** allows merchants to integrate with the PayGo Dash vending platform to perform secure vending, manage meters, retrieve status and readings, and handle tamper events.

In the [Swagger UI](https://api.paygodash.com/docs/api-merchants), the API is grouped into:

1. **API-Merchants** – Merchant account management, vending operations, tamper management, and customer creation.
2. **API for GSM Meters** – GSM-specific controls, meter operations, and data retrieval.
3. **default** – General or supporting endpoints.

This documentation mirrors the same grouping order.

***

### **Environments**

| Environment    | Base URL                                       |
| -------------- | ---------------------------------------------- |
| **Production** | `https://api.paygodash.com`                    |
| **Staging**    | `https://paygodash-be-tli2.vercel.app`         |
| **Swagger**    | `https://api.paygodash.com/docs/api-merchants` |

***

### **Authentication**

All API calls (except login) require a Bearer token in the `Authorization` header.

**Steps:**

1. Call `/merchant-login` to get a token.
2. Send the token with every request:

   ```
   Authorization: Bearer <your_token_here>
   ```

***

## **Group 1: API-Merchants**

#### **Merchant Login**

`POST /api/v1/api-merchant/auth-merchant-login`

```json
{
  "phone": "string",
  "password": "string"
}
```

Response:

```json
{
  "phone": "string",
  "password": "string",
  "token": "string"
}
```

***

#### **Vend Token**

`POST /api/v1/api-merchant/topup`

```json
{
  "meterNumber": "string",
  "unit": 0
}
```

Response:

```json
{
  "success": true,
  "message": "string",
  "data": {
    "status": "string",
    "description": "string",
    "token": "string",
    "tid": 0,
    "transferAmount": 0,
    "scaledAmount": "string",
    "newConfig": {}
  }
}
```

***

#### **Clear Tamper Token**

`POST /api/v1/api-merchant/clear-tamper/generate-token`

```json
{
  "meterNumber": "string"
}
```

Response:

```json
{
  "success": true,
  "data": {
    "description": "string",
    "token": "string",
    "tid": 0,
    "transferAmount": 0,
    "scaledAmount": "string",
    "newConfig": {}
  }
}
```

***

#### **Send Tamper Token**

`POST /api/v1/api-merchant/clear-tamper/token/send`

```json
{
  "meterNumber": "string",
  "token": "string"
}
```

Response:

```json
{
  "success": true,
  "message": "string",
  "data": {
    "status": true,
    "data": {}
  }
}
```

***

#### **Set Meter Max Power**

`POST /api/v1/api-merchant/max-power/limit`

```json
{
  "meterNumber": "string",
  "value": 0
}
```

Response:

```json
{
  "success": true,
  "data": {
    "description": "string",
    "token": "string",
    "tid": 0,
    "transferAmount": 0,
    "scaledAmount": "string",
    "newConfig": {}
  }
}
```

***

#### **Create Customer with Meter**

`POST /api/v1/api-merchant/create-customer-with-meter`

```json
{
  "meterNumber": "09034988888",
  "tariffIndex": 1,
  "tariff": 1,
  "meterType": "ELECTRICITY",
  "meterBrand": "OTHERS",
  "firstName": "John",
  "lastName": "Doe",
  "email": "john.doe@example.com",
  "phone": "1234567890"
}
```

Response:

```json
{
  "success": true,
  "message": "string",
  "data": {
    "user": {
      "id": "string",
      "firstName": "string",
      "lastName": "string",
      "email": "string",
      "phone": "string",
      "meterNumber": "string",
      "tariffIndex": "string",
      "tariff": "string",
      "meterType": "string",
      "meterBrand": "string",
      "meterAddress": "string"
    }
  }
}
```

***

## **Group 2: API for GSM Meters**

#### **Merchant Login**

`POST /api/v1/api-merchant/merchant-login`\
(Same structure as in API-Merchants group)

***

#### **Create Meter**

`POST /api/v1/api-merchant/create/meter`

```json
{
  "meterNumber": "string"
}
```

***

#### **Get All Merchant Meters**

`GET /api/v1/api-merchant/meters`

***

#### **Turn ON/OFF Meter**

`POST /api/v1/api-merchant/meter/power-control`

```json
{
  "meterNumber": "string",
  "status": "OFF"
}
```

***

#### **Maximum Power Settings**

`POST /api/v1/api-merchant/meter/set-max-power`

```json
{
  "meterNumber": "string",
  "maxPower": 0
}
```

***

#### **View Tamper Event Flag**

`GET /api/v1/api-merchant/meter/view-clamper/{meterNumber}`

***

#### **Clear Tamper Event Flag**

`GET /api/v1/api-merchant/meter/clear-tamper/{meterNumber}`

***

#### **View Meter Online Status**

`GET /api/v1/api-merchant/meter/online/{meterNumber}`

***

#### **Real-time Readings**

`GET /api/v1/api-merchant/meter/real-time-readings/{meterNumber}`

***

#### **Recent Control Results**

`GET /api/v1/api-merchant/meter/recent-control-results/{meterNumber}`

***

#### **Energy Consumption Data**

`GET /api/v1/api-merchant/meter/energy-consumption-data/{meterNumber}`

***

#### **View Meter GPRS Status**

`GET /api/v1/api-merchant/meter/gprs-online-status/{meterNumber}`

***

#### **Get Meter Tamper Status**

`GET /api/v1/api-merchant/meter/temper-status/{meterNumber}`

***

#### **Electric Curve Profile**

`POST /api/v1/api-merchant/meter/profile/energy-load`

```json
{
  "meterNumber": "string"
}
```

***

#### **Instantaneous Energy Load Profile**

`POST /api/v1/api-merchant/meter/profile/instanteneous-energy-load`

```json
{
  "meterNumber": "string"
}
```

***

#### **Monthly Energy Load Profile**

`GET /api/v1/api-merchant/meter/profile/monthly-energy-load/{meterNumber}`

***

#### **Daily Energy Load Profile**

`GET /api/v1/api-merchant/meter/profile/daily-energy-load/{meterNumber}`

***

## **Group 3: default**

#### **Vend Token (Offline)**

`POST /api/v1/api-merchant/topup-ref/offline`

```json
{
  "reference": "string",
  "amount": 0,
  "meterNumber": "string"
}
```

Response:

```json
{
  "status": true,
  "message": "Topup successful",
  "data": {
    "reference": "string",
    "amount": 0,
    "meterNumber": "string",
    "token": "string"
  }
}
```

***

### **Error Handling**

**Error Response**

```json
{
  "status": false,
  "message": "Invalid meter number"
}
```
