# List Transactions

GET https://services.leadconnectorhq.com/payments/transactions

The "List Transactions" API allows to retrieve a paginated list of transactions. Customize your results by filtering transactions based on name, alt type, transaction status, payment mode, date range, type of source, contact, subscription id, entity id or paginate through the list using the provided query parameters. This endpoint provides a straightforward way to explore and retrieve transaction information.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `payments/transactions.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | No | LocationId is the id of the sub-account. |
| `altId` | string | Yes | AltId is the unique identifier e.g: location id. |
| `altType` | string | Yes | AltType is the type of identifier. |
| `paymentMode` | string | No | Mode of payment. |
| `startAt` | string | No | Starting interval of transactions. |
| `endAt` | string | No | Closing interval of transactions. |
| `entitySourceType` | string | No | Source of the transactions. |
| `entitySourceSubType` | string | No | Source sub-type of the transactions. |
| `search` | string | No | The name of the transaction for searching. |
| `subscriptionId` | string | No | Subscription id for filtering of transactions. |
| `entityId` | string | No | Entity id for filtering of transactions. |
| `contactId` | string | No | Contact id for filtering of transactions. |
| `limit` | number | No | The maximum number of items to be included in a single page of results |
| `offset` | number | No | The starting index of the page, indicating the position from which the results should be retrieved. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/payments/transactions": {
      "get": {
        "summary": "List Transactions",
        "operationId": "listTransactions",
        "description": "The \"List Transactions\" API allows to retrieve a paginated list of transactions. Customize your results by filtering transactions based on name, alt type, transaction status, payment mode, date range, type of source, contact, subscription id, entity id or paginate through the list using the provided query parameters. This endpoint provides a straightforward way to explore and retrieve transaction information.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "locationId",
            "required": false,
            "in": "query",
            "description": "LocationId is the id of the sub-account.",
            "schema": {
              "example": "3SwdhCu3svxI8AKsPJt6",
              "type": "string"
            }
          },
          {
            "name": "altId",
            "required": true,
            "in": "query",
            "description": "AltId is the unique identifier e.g: location id.",
            "schema": {
              "example": "3SwdhCu3svxI8AKsPJt6",
              "type": "string"
            }
          },
          {
            "name": "altType",
            "required": true,
            "in": "query",
            "description": "AltType is the type of identifier.",
            "schema": {
              "example": "location",
              "type": "string"
            }
          },
          {
            "name": "paymentMode",
            "required": false,
            "in": "query",
            "description": "Mode of payment.",
            "schema": {
              "example": "live",
              "type": "string"
            }
          },
          {
            "name": "startAt",
            "required": false,
            "in": "query",
            "description": "Starting interval of transactions.",
            "schema": {
              "example": "2024-02-01",
              "type": "string"
            }
          },
          {
            "name": "endAt",
            "required": false,
            "in": "query",
            "description": "Closing interval of transactions.",
            "schema": {
              "example": "2024-02-13",
              "type": "string"
            }
          },
          {
            "name": "entitySourceType",
            "required": false,
            "in": "query",
            "description": "Source of the transactions.",
            "schema": {
              "example": "funnel",
              "type": "string"
            }
          },
          {
            "name": "entitySourceSubType",
            "required": false,
            "in": "query",
            "description": "Source sub-type of the transactions.",
            "schema": {
              "example": "two_step_order_form",
              "type": "string"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "The name of the transaction for searching.",
            "schema": {
              "example": "Awesome transaction",
              "type": "string"
            }
          },
          {
            "name": "subscriptionId",
            "required": false,
            "in": "query",
            "description": "Subscription id for filtering of transactions.",
            "schema": {
              "example": "sub_1KGcXDCScnf89tZoVkoEMCEL",
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "required": false,
            "in": "query",
            "description": "Entity id for filtering of transactions.",
            "schema": {
              "example": "61dd0fe9c077f73e67f78803",
              "type": "string"
            }
          },
          {
            "name": "contactId",
            "required": false,
            "in": "query",
            "description": "Contact id for filtering of transactions.",
            "schema": {
              "example": "XPLSw2SVagl12LMDeTmQ",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "The maximum number of items to be included in a single page of results",
            "schema": {
              "default": 10,
              "example": 20,
              "type": "number"
            }
          },
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "description": "The starting index of the page, indicating the position from which the results should be retrieved.",
            "schema": {
              "default": 0,
              "example": 0,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTxnsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": [
              "payments/transactions.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "ListTxnsResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "description": "An array of transactions",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "_id": {
                  "type": "string",
                  "description": "The unique identifier for the transaction.",
                  "example": "61dd0feac077f72010f78804"
                },
                "altId": {
                  "type": "string",
                  "description": "AltId is the unique identifier eg: location id.",
                  "example": "3SwdhCu3svxI8AKsPJt6"
                },
                "altType": {
                  "type": "string",
                  "example": "location",
                  "description": "AltType is the type of identifier."
                },
                "contactId": {
                  "type": "string",
                  "example": "XPLSw2SVagl12LMDeTmQ",
                  "description": "Contact id corresponding to the transaction."
                },
                "mergedFromContactId": {
                  "type": "string",
                  "example": "XPLSw2SVagl12LMDeTmQ",
                  "description": "ID of the contact that was merged from."
                },
                "contactName": {
                  "type": "string",
                  "example": "James Bond",
                  "description": "Contact name corresponding to the transaction."
                },
                "contactEmail": {
                  "type": "string",
                  "example": "james.bond@gohighlevel.com",
                  "description": "Contact email corresponding to the transaction."
                },
                "currency": {
                  "type": "string",
                  "example": "USD",
                  "description": "Currency in which transaction occurred."
                },
                "amount": {
                  "type": "number",
                  "example": "100",
                  "description": "Transaction value."
                },
                "status": {
                  "type": "object",
                  "description": "The status of the transaction (e.g., succeeded).",
                  "example": "succeeded"
                },
                "liveMode": {
                  "type": "boolean",
                  "example": "false",
                  "description": "Transaction is in live / test mode."
                },
                "entityType": {
                  "type": "string",
                  "example": "order",
                  "description": "Entity type of transaction (eg: order)."
                },
                "entityId": {
                  "type": "string",
                  "example": "61dd0fe9c077f73e67f78803",
                  "description": "Entity id for the transaction. e.g: order id"
                },
                "entitySourceType": {
                  "type": "string",
                  "example": "funnel",
                  "description": "Entity source type of transaction (eg: funnel)."
                },
                "entitySourceSubType": {
                  "type": "string",
                  "example": "two_step_order_form",
                  "description": "Entity source sub-type of the transactions."
                },
                "entitySourceName": {
                  "type": "string",
                  "example": "new funnel",
                  "description": "Entity source name for the transaction."
                },
                "entitySourceId": {
                  "type": "string",
                  "description": "Entity source id for the transaction.",
                  "example": "BDBMEghdIUaqMPEsK349"
                },
                "entitySourceMeta": {
                  "type": "object",
                  "description": "Meta content for the entity source of transaction.",
                  "example": "{ domain: \"app.gohighlevel.com\", pageId:  \"rBVhyYhMsbxbO8ZqOcei\", pageUrl:  \"/v2/preview/rBVhyYhMsbxbO8ZqOcei\", stepId:   \"5a772f62-3fbc-418b-af1b-be8929dd64c2\"}"
                },
                "subscriptionId": {
                  "type": "string",
                  "example": "sub_1KGcXDCScnf89tZoVkoEMCEL",
                  "description": "Subscription id for transaction."
                },
                "chargeId": {
                  "type": "string",
                  "example": "in_1KGcXDCScnf89tZohCsmImwE",
                  "description": "Charge id for transaction."
                },
                "chargeSnapshot": {
                  "type": "object",
                  "description": "Charge snapshot of transaction.",
                  "example": "{ id: \"in_1KGcXDCScnf89tZohCsmImwE\", object: \"invoice\", account_country: \"US\",  account_name:  \"GHL-Testing\" }"
                },
                "paymentProviderType": {
                  "type": "string",
                  "example": "stripe",
                  "description": "Payment provider for transaction."
                },
                "paymentProviderConnectedAccount": {
                  "type": "string",
                  "example": "612ca676b484b241fef9d962",
                  "description": "Payment provider  account id for transaction."
                },
                "ipAddress": {
                  "type": "string",
                  "example": "107.178.194.224",
                  "description": "Ip address from where transaction was initiated."
                },
                "createdAt": {
                  "format": "date-time",
                  "type": "string",
                  "description": "The creation timestamp of the transaction.",
                  "example": "2023-11-20T10:23:36.515Z"
                },
                "updatedAt": {
                  "format": "date-time",
                  "type": "string",
                  "description": "The update timestamp of the transaction.",
                  "example": "2023-11-20T10:23:36.515Z"
                },
                "amountRefunded": {
                  "type": "number",
                  "example": "10",
                  "description": "Transaction amount refunded."
                },
                "paymentMethod": {
                  "type": "object",
                  "example": "{ card: { \"brand\": \"discover\", \"last4\": \"0012\" } }",
                  "description": "Transaction payment method details."
                },
                "fulfilledAt": {
                  "format": "date-time",
                  "type": "string",
                  "description": "The charged timestamp of the transaction.",
                  "example": "2023-11-20T10:27:36.515Z"
                },
                "createdBy": {
                  "type": "string",
                  "example": "user123",
                  "description": "User ID who created the transaction."
                }
              },
              "required": [
                "_id",
                "altId",
                "altType",
                "status",
                "entitySourceType",
                "createdAt",
                "updatedAt",
                "fulfilledAt"
              ],
              "title": "TxnResponseSchema"
            }
          },
          "totalCount": {
            "type": "number",
            "description": "total transactions count"
          }
        },
        "required": [
          "data",
          "totalCount"
        ],
        "title": "ListTxnsResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/payments/transactions?altId=<ALTID>&altType=<ALTTYPE>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/payments/transactions?altId=<ALTID>&altType=<ALTTYPE>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/payments/transactions"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

params = {
    "altId": "<ALTID>",
    "altType": "<ALTTYPE>"
}

response = requests.get(url, params=params, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/payments/transactions?altId=<ALTID>&altType=<ALTTYPE>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/payments/transactions?altId=<ALTID>&altType=<ALTTYPE>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  url := "https://services.leadconnectorhq.com/payments/transactions?altId=<ALTID>&altType=<ALTTYPE>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/payments/transactions?altId=<ALTID>&altType=<ALTTYPE>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/payments/transactions?altId=<ALTID>&altType=<ALTTYPE>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
