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

# Query All Payments

> Query all payments with filtering, sorting, and pagination capabilities



## OpenAPI

````yaml GET /payments/all
openapi: 3.0.1
info:
  title: CORE API OpenAPI Specification
  description: This is the API documentation for the ClickPesa CORE API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.clickpesa.com/third-parties
security:
  - bearerAuth: []
paths:
  /payments/all:
    get:
      description: Query all payments with filtering, sorting, and pagination capabilities
      parameters:
        - name: startDate
          in: query
          required: false
          schema:
            type: string
            format: date
          description: >-
            Start date for filtering payments . Accepted formats :  `YYYY-MM-DD`
            or `DD-MM-YYYY`
        - name: endDate
          in: query
          required: false
          schema:
            type: string
            format: date
          description: >-
            End date for filtering payments . Accepted formats :  `YYYY-MM-DD`
            or `DD-MM-YYYY`
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - SUCCESS
              - SETTLED
              - PROCESSING
              - PENDING
              - FAILED
          description: Payment status filter
        - name: collectedCurrency
          in: query
          required: false
          schema:
            type: string
          description: Currency filter (e.g., TZS, USD)
        - name: channel
          in: query
          required: false
          schema:
            type: string
          description: Payment channel filter
        - name: orderReference
          in: query
          required: false
          schema:
            type: string
          description: Order reference filter
        - name: clientId
          in: query
          required: false
          schema:
            type: string
          description: Client ID filter
        - name: sortBy
          in: query
          required: false
          schema:
            type: string
          description: >-
            Field to sort by (default: createdAt). All response fields are
            sortable including customer fields
        - name: orderBy
          in: query
          required: false
          schema:
            type: string
            enum:
              - ASC
              - DESC
            default: DESC
          description: 'Sort order (default: DESC)'
        - name: skip
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
          description: Number of records to skip for pagination
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            default: 20
          description: Number of records to return
      responses:
        '200':
          description: Query all payments response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentsListResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          description: Invalid or Expired Token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
components:
  schemas:
    PaymentsListResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/PaymentResponse'
          description: Array of payment records
        totalCount:
          type: integer
          description: Total number of payments matching the query criteria
    BadRequestError:
      type: object
      properties:
        message:
          type: string
          description: Bad request error message
    UnauthorizedError:
      type: object
      properties:
        message:
          type: string
          description: Unauthorized Error
          example: Unauthorized
    PaymentResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique transaction ID
        status:
          type: string
          description: Payment status
          enum:
            - SUCCESS
            - SETTLED
            - PROCESSING
            - PENDING
            - FAILED
        exchanged:
          type: boolean
          description: >-
            Indicates if currency conversion was applied (true when source
            currency differs from receiving currency)
          example: true
        exchange:
          type: object
          description: Exchange rate details (only present when exchanged is true)
          properties:
            sourceCurrency:
              type: string
              description: Source currency for the exchange
              example: USD
            targetCurrency:
              type: string
              description: Target currency for the exchange
              example: TZS
            sourceAmount:
              type: number
              description: Amount in source currency
              example: 1000
            rate:
              type: number
              description: Exchange rate used for conversion
              example: 2500
        paymentReference:
          type: string
          description: Unique reference for the payment
        paymentPhoneNumber:
          type: string
          description: >-
            Sender's phone number (only available for USSD Push Payment requests
            and BillPay Payment requests)
          example: '255712345678'
        orderReference:
          type: string
          description: Order reference associated with the payment
        collectedAmount:
          type: integer
          description: Amount collected
        collectedCurrency:
          type: string
          description: Currency in which payment was collected
        message:
          type: string
          description: Message describing payment status
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when payment was last updated
        createdAt:
          type: string
          format: date-time
          description: Timestamp when payment was created
        customer:
          type: object
          properties:
            customerName:
              type: string
              description: Customer's full name
            customerPhoneNumber:
              type: string
              description: Customer's phone number
            customerEmail:
              type: string
              format: email
              description: Customer's email (if available)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````