# Search payments

**Advanced payment filtering with custom GraphQL where clauses and dynamic ordering**
Backed by view `vw_payment_history_firm_table`. Supports text matching, date ranges, and flags.
Real Example:

```bash
curl --location 'https://{{host}}/v1/payments/search' \
--header 'Authorization: bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
  "pageSize": 1,
  "where": {
    "_and": [
      {
        "_or": [
          {
            "paymentMethod": {
              "_ilike": "%CREDIT%"
            }
          },
          {
            "cardType": {
              "_ilike": "%VISA%"
            }
          }
        ]
      },
      {
        "isAutomatic": {
          "_eq": false
        }
      },
      {
        "createdAt": {
          "_gte": "1900-01-01T00:00:00Z"
        }
      },
      {
        "paymentConfirmationDate": {
          "_is_null": false
        }
      }
    ]
  },
  "orderBy": [
    {
      "paymentConfirmationDate": "desc"
    },
    {
      "createdAt": "desc"
    }
  ]
}'
```

Endpoint: POST /gql/v1/payments/search
Version: 1.0.0
Security: BearerAuth

## Request fields (application/json):

  - `pageSize` (integer)

  - `where` (object)
    GraphQL-style where clause for complex payment filtering
    Example: {"_and":[{"_or":[{"paymentMethod":{"_ilike":"%CREDIT%"}},{"cardType":{"_ilike":"%VISA%"}}]},{"isAutomatic":{"_eq":false}},{"createdAt":{"_gte":"1900-01-01T00:00:00Z"}},{"paymentConfirmationDate":{"_is…

  - `orderBy` (array)
    Dynamic ordering specifications
    Example: [{"paymentConfirmationDate":"desc"},{"createdAt":"desc"}]

