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

# List all payments

> List all payments

export const ListAPIInfo = ({info: {query_fields, allowed_combinations, search_fields, sort_fields, default_sort}, show_filter_combinations}) => {
  return <AccordionGroup>
    {query_fields != null && query_fields.length > 0 ? <Accordion title="Query Parameters">
      {query_fields.map(field => <ParamField key={field} query={field.name} type={field.type}>
            {field.description}
          </ParamField>)}
    </Accordion> : ''}

    {allowed_combinations != null && allowed_combinations.length > 0 ? <Accordion title="Filterable Fields">
      {[...new Set(allowed_combinations.flat())].map(field => <ParamField key={field} query={field} type="string" />)}
      {show_filter_combinations ? <>
        <h3 style={{
    marginTop: "0em"
  }}>Allowed filter combinations</h3>
        <ul>
          {allowed_combinations.map(comb => <li key="a">
              {comb.map((e, i) => <><code>{e}</code>{i != comb.length - 1 ? ", " : ""}</>)}
            </li>)}
        </ul>
        </> : ''}
    </Accordion> : ''}

    {search_fields != null && search_fields.length > 0 ? <Accordion title="Searchable Fields">
      Fields that can be searched on using <code>_search</code> query param
      {search_fields.map(field => <ParamField key={field} query={field.name} type={field.type}>
            {field.description}
          </ParamField>)}
    </Accordion> : ''}

    {sort_fields != null && sort_fields.length > 0 ? <Accordion title="Sortable Fields">
      Fields with which the list response can be sorted using <code>_sort</code> query param
      {sort_fields.map(field => <ParamField key={field} query={field.name} type={field.type}>
            {field.description}
          </ParamField>)}
      {default_sort ? <Note>
            Default sort order:<code>{Object.entries(default_sort).map(e => e[0] + " " + e[1]).join(', ')}</code>
          </Note> : ''}
    </Accordion> : ''}

      
  </AccordionGroup>;
};

export const listPaymentsQueryFields = {
  query_fields: [{
    name: "id",
    type: "string",
    description: "Unique identifier of the payment"
  }, {
    name: "account_id",
    type: "string",
    description: "Unique identifier of the account associated with the payment"
  }, {
    name: "created_at",
    type: "string",
    description: "Creation date of the payment"
  }],
  allowed_combinations: [["id"], ["account_id"], ["account_id", "created_at"]],
  sort_fields: [{
    name: "created_at",
    type: "string",
    description: ""
  }, {
    name: "id",
    type: "string",
    description: ""
  }],
  default_sort: {
    "created_at": "DESC",
    "id": "ASC"
  }
};

<ListAPIInfo info={listPaymentsQueryFields} show_filter_combinations />


## OpenAPI

````yaml get /payments
openapi: 3.0.3
info:
  version: '1.0'
  title: Togai Apis
  contact:
    email: engg@togai.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  description: APIs for Togai App
servers:
  - description: Api endpoint
    url: https://api.togai.com/
  - description: Sandbox api endpoint
    url: https://sandbox-api.togai.com/
security:
  - bearerAuth: []
tags:
  - name: Customers
    description: Customer level calls
  - name: Accounts
    description: Account level calls
  - name: Event Schemas
    description: Event Schema level calls
  - name: Usage Meters
    description: Usage Meter level calls
  - name: Price Plans
    description: (DEPRECATED) Price Plan level calls
  - name: PricePlanV2
    description: Price Plan V2 level calls
  - name: Schedules
    description: Account Schedule level calls
  - name: Pricing Rules
    description: Pricing Rules level calls
  - name: Settings
    description: Settings
  - name: Price Experimentation
    description: Price Experimentation apis
  - name: InvoiceGroups
    description: Invoice Group level calls
  - name: Organization
    description: Organization level calls
  - name: FileStorage
    description: File Storage level calls
  - name: Aliases
    description: Alias level calls
  - name: Reports
    description: Report level calls
  - name: ReportTemplates
    description: Report Template level calls
  - name: Customer Portal
    description: Portal level calls
  - name: Alerts
    description: Alert level calls
  - name: Event Management
    description: APIs for getting events ingested in Togai
    externalDocs:
      description: docs
      url: https://togai.com/docs/billing/events
  - name: Metrics
    description: APIs for getting Togai metrics
    externalDocs:
      description: docs
      url: https://togai.com/docs/metrics
  - name: Licenses
    description: APIs for getting or updating license records in Togai
  - name: Entitlements
    description: APIs related to entitlements
  - name: Invoices
    description: Invoices API
  - name: Credits
    description: Credits API
  - name: Wallet
    description: Wallet API
  - name: InvoiceTemplates
    description: InvoiceTemplates API
  - name: InvoiceSequence
    description: InvoiceSequence API
  - name: Payments
    description: Payments API
  - name: Authentication
    description: Authentication API
externalDocs:
  description: Find out more about Togai
  url: https://docs.togai.com/docs
paths:
  /payments:
    get:
      tags:
        - Payments
      summary: List all payments
      description: List all payments
      operationId: listPayments
      parameters:
        - $ref: '#/components/parameters/filter_next_page_token'
        - $ref: '#/components/parameters/filter_page_size'
      responses:
        '200':
          $ref: '#/components/responses/ListPaymentResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
        '401':
          $ref: '#/components/responses/ErrorResponse'
        '403':
          $ref: '#/components/responses/ErrorResponse'
        '404':
          $ref: '#/components/responses/ErrorResponse'
        '429':
          $ref: '#/components/responses/ErrorResponse'
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    filter_next_page_token:
      in: query
      description: Pagination token used as a marker to get records from next page.
      name: nextToken
      required: false
      schema:
        type: string
        example: >-
          eyJsYXN0SXRlbUlkIjogInN0cmluZyIsICJwYWdlU2l6ZSI6IDEyMywgInNvcnRPcmRlciI6ICJhc2MifQ==
    filter_page_size:
      in: query
      description: |-
        Maximum page size expected by client to return the record list. 

         NOTE: Max page size cannot be more than 50. Also 50 is the default page size if no value is provided.
      name: pageSize
      required: false
      schema:
        type: integer
        example: 10
  responses:
    ListPaymentResponse:
      description: Response for GET payments requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ListPaymentResponse'
          examples:
            ListPaymentResponse:
              $ref: '#/components/examples/ListPaymentResponse'
    ErrorResponse:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            ErrorResponse:
              summary: Error message
              value:
                message: <Reason message>
  schemas:
    ListPaymentResponse:
      description: List payments response
      type: object
      additionalProperties: false
      required:
        - data
      properties:
        data:
          type: array
          minItems: 0
          maxItems: 50
          items:
            $ref: '#/components/schemas/Payment'
        nextToken:
          type: string
          maxLength: 500
          example: >-
            eyJsYXN0SXRlbUlkIjogInN0cmluZyIsICJwYWdlU2l6ZSI6IDEyMywgInNvcnRPcmRlciI6ICJhc2MifQ==
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - message
      properties:
        message:
          type: string
          description: error description
          maxLength: 500
    Payment:
      description: Payment object
      type: object
      additionalProperties: false
      required:
        - id
        - accountId
        - externalPaymentReferences
        - lineItemRecords
        - totalAmount
        - currency
        - version
        - createdBy
        - createdAt
      properties:
        id:
          type: string
          example: pay.w123rwe.1231
        description:
          type: string
        notes:
          type: string
        accountId:
          type: string
          example: ACC001
        externalPaymentReferences:
          $ref: '#/components/schemas/ExternalPaymentReference'
        lineItemRecords:
          type: array
          minLength: 1
          items:
            $ref: '#/components/schemas/PaymentLineItemRecord'
        totalAmount:
          type: number
        currency:
          type: string
        version:
          type: number
        createdBy:
          type: string
        createdAt:
          type: string
          format: date-time
    ExternalPaymentReference:
      type: object
      description: external payment reference object
      additionalProperties: false
      required:
        - sourceName
        - sourceType
        - transactionNumber
      properties:
        sourceName:
          type: string
        sourceType:
          type: string
          enum:
            - GATEWAY
            - CASH
            - CHEQUE
            - BANK_TRANSFER
            - CARD
        transactionNumber:
          description: Check number or Card transaction number
          type: string
        description:
          type: string
        metadata:
          type: object
          additionalProperties: true
    PaymentLineItemRecord:
      type: object
      description: payment line item record object
      additionalProperties: false
      required:
        - type
        - order
      properties:
        type:
          type: string
          enum:
            - INVOICE
            - CREDIT
            - WALLET_CREDIT
        togaiId:
          type: string
          example: inv.234.12efwe
        amount:
          type: number
        order:
          type: integer
          format: int32
  examples:
    ListPaymentResponse:
      summary: A sample list payments response
      value:
        data:
          - id: payment.1223dfs.234ds
            description: Payment for services
            notes: Invoice payment
            accountId: acc123
            currency: USD
            externalPaymentReferences:
              sourceName: XYZ Company
              sourceType: CARD
              transactionNumber: TXN123
              description: Card payment
            lineItemRecords:
              - togaiId: inv.234.12efwe
                amount: 1000
                type: INVOICE
                order: 1
              - togaiId: inv.235.12efwe
                amount: 600
                type: INVOICE
                order: 2
              - togaiId: cred.236.12efwe
                amount: 100
                type: CREDIT
                order: 3
            totalAmount: 1700
            version: 1
            createdBy: user123
            createdAt: '2023-01-01T12:00:00'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Bearer <credential>

````