openapi: 3.0.1
info:
  title: Adfin API
  description: >-
    Adfin uses OAuth 2.0 access tokens to authenticate all API requests.


    There are two contexts in which tokens are issued:


    - **Biller Access Tokens** — Generated via the Authorization Code flow when
    a biller connects their Adfin account. These tokens grant access to that
    biller's data (invoices, payment requests, customers, etc.).


    - **Platform Access Tokens** — Generated via the Client Credentials flow for
    Adfin's own integrations and system events. These tokens authenticate Adfin
    as the platform itself (not as a specific biller) and are required for
    endpoints like `/api/webhook`.
  version: 1.0.0
servers:
  - url: https://api.adfin.com/api
    description: Production API Server URL
  - url: https://api.staging.adfin.com/api
    description: Staging API Server URL
security:
  - Biller Access Token (Production): []
  - Biller Access Token (Staging): []
  - Adfin Bearer Token: []
tags:
  - name: oAuth2
  - name: Biller
  - name: Customers
  - name: Direct debit mandates
  - name: Invoices
  - name: Recurring invoices
  - name: Payment requests
  - name: Recurring payment requests
  - name: Payments
  - name: Tax rates
  - name: Items
  - name: Workflows
    description: Manage workflow configurations
  - name: Workflows
  - name: Webhooks
paths:
  /workflows:
    put:
      tags:
        - Workflows
      summary: Create a new workflow
      operationId: createWorkflow
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWorkflowRequest'
        required: true
      responses:
        '200':
          description: >-
            The request was successful, resulting in the creation of one
            workflow.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowResponse'
        '400':
          description: >-
            There was an issue reading or understanding the request. Please
            ensure that it adheres to the required format and includes all
            necessary parameters.
        '401':
          description: Authentication is required.
        '422':
          description: A validation error occurred with the request.
        '500':
          description: The server was unable to process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /schedules/payment_requests/{id}:
    get:
      tags:
        - Recurring payment requests
      summary: Retrieve a recurring payment request by its ID
      operationId: getRecurringPaymentRequestById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringPaymentRequestResponse'
        '201':
          description: >-
            The request was successful and the recurring payment request was
            retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringPaymentRequestResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '404':
          description: Recurring payment request does not exist.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    put:
      tags:
        - Recurring payment requests
      summary: Update a recurring payment request
      operationId: updateRecurringPaymentRequest
      parameters:
        - name: id
          in: path
          description: The Adfin ID of the recurring payment request
          required: true
          schema:
            type: string
            description: The Adfin ID of the recurring payment request
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRecurringPaymentRequestRequest'
        required: true
      responses:
        '200':
          description: >-
            The request has succeeded and has resulted in one recurring payment
            request being updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringInvoiceResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringPaymentRequestResponse'
        '401':
          description: Authentication required.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    delete:
      tags:
        - Recurring payment requests
      summary: Delete a recurring payment request
      operationId: deleteRecurringPaymentRequest
      parameters:
        - name: id
          in: path
          description: The Adfin ID of the recurring payment request to be deleted
          required: true
          schema:
            type: string
            description: The Adfin ID of the recurring payment request to be deleted
      responses:
        '204':
          description: The recurring payment request was deleted
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /schedules/payment_requests/{id}:cancel:
    put:
      tags:
        - Recurring payment requests
      summary: Cancel a recurring payment request
      operationId: cancelRecurringPaymentRequest
      parameters:
        - name: id
          in: path
          description: The Adfin ID of the recurring payment request
          required: true
          schema:
            type: string
            description: The Adfin ID of the recurring payment request
      responses:
        '200':
          description: The recurring payment request has been cancelled
        '404':
          description: No recurring payment request can be found
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /schedules/invoices/{id}:
    get:
      tags:
        - Recurring invoices
      summary: Retrieve a recurring invoice
      operationId: getRecurringInvoiceById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringInvoiceResponse'
        '201':
          description: The request was successful and the recurring invoice was retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringInvoiceResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '404':
          description: Recurring invoice does not exist.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    put:
      tags:
        - Recurring invoices
      summary: Update a recurring invoice
      operationId: updateRecurringInvoice
      parameters:
        - name: id
          in: path
          description: The Adfin ID of the recurring invoice
          required: true
          schema:
            type: string
            description: The Adfin ID of the recurring invoice
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRecurringInvoiceRequest'
        required: true
      responses:
        '200':
          description: >-
            The request has succeeded and has resulted in one recurring invoice
            being updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringInvoiceResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringInvoiceResponse'
        '401':
          description: Authentication required.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    delete:
      tags:
        - Recurring invoices
      summary: Delete a recurring invoice
      operationId: deleteRecurringInvoice
      parameters:
        - name: id
          in: path
          description: The Adfin ID of the recurring invoice to be deleted
          required: true
          schema:
            type: string
            description: The Adfin ID of the recurring invoice to be deleted
      responses:
        '204':
          description: The recurring invoice was deleted
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /schedules/invoices/{id}:cancel:
    put:
      tags:
        - Recurring invoices
      summary: Cancel a recurring invoice
      operationId: cancelRecurringInvoice
      parameters:
        - name: id
          in: path
          description: The Adfin ID of the recurring invoice
          required: true
          schema:
            type: string
            description: The Adfin ID of the recurring invoice
      responses:
        '200':
          description: The recurring invoice has been cancelled
        '404':
          description: No recurring invoice can be found
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /schedules/invoices/{id}:activate:
    put:
      tags:
        - Recurring invoices
      summary: Activate a recurring invoice
      operationId: activateRecurringInvoice
      parameters:
        - name: id
          in: path
          description: The Adfin ID of the recurring invoice
          required: true
          schema:
            type: string
            description: The Adfin ID of the recurring invoice
      responses:
        '200':
          description: The recurring invoice has been activated
        '404':
          description: No recurring invoice can be found
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /payment_requests/{id}:
    get:
      tags:
        - Payment requests
      summary: Get a payment request
      operationId: getPr
      parameters:
        - name: id
          in: path
          description: The ID of the payment request
          required: true
          schema:
            type: string
            description: The ID of the payment request
      responses:
        '200':
          description: The payment request is successfully retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequestResponse'
        '404':
          description: No payment request can be found
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    put:
      tags:
        - Payment requests
      summary: Update a payment request
      operationId: putPaymentRequest
      parameters:
        - name: id
          in: path
          description: The ID of the payment request
          required: true
          schema:
            type: string
            description: The ID of the payment request
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePaymentRequestRequest'
        required: true
      responses:
        '200':
          description: >-
            The request has succeeded and has resulted in one payment request
            being updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequestResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequestResponse'
        '401':
          description: Authentication required.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /payment_requests/{id}:void:
    put:
      tags:
        - Payment requests
      summary: Void a payment request
      operationId: voidPr
      parameters:
        - name: id
          in: path
          description: The ID of the payment request
          required: true
          schema:
            type: string
            description: The ID of the payment request
      responses:
        '200':
          description: The payment request has been voided
        '404':
          description: No payment request can be found
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /payment_requests/{id}:cancel:
    put:
      tags:
        - Payment requests
      summary: Cancel a payment request
      description: >-
        This endpoint is deprecated and will be removed in a future release. Use
        /{id}:void instead
      operationId: cancelPr
      parameters:
        - name: id
          in: path
          description: The ID of the payment request
          required: true
          schema:
            type: string
            description: The ID of the payment request
      responses:
        '200':
          description: The payment request has been cancelled
        '404':
          description: No payment request can be found
        '500':
          description: The server could not process the request.
      deprecated: true
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /payment_requests/{id}:activate:
    put:
      tags:
        - Payment requests
      summary: Activate (send) a payment request
      operationId: activatePr
      parameters:
        - name: id
          in: path
          description: The id of the payment request
          required: true
          schema:
            type: string
            description: The id of the payment request
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivateInvoiceRequest'
        required: true
      responses:
        '200':
          description: The payment request was activated
        '400':
          description: The payment request can not be activated
        '404':
          description: The payment request does not exist
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /payment_requests/distribution:
    put:
      tags:
        - Payment requests
      summary: Update the distribution details of payment requests
      operationId: updateDistributionDetails
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDistributionDetailsRequest'
        required: true
      responses:
        '200':
          description: The distribution details were updated
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /invoices/{id}:
    get:
      tags:
        - Invoices
      summary: Get an invoice by its id
      operationId: getInvoice
      parameters:
        - name: id
          in: path
          description: The id of the invoice to get the details for
          required: true
          schema:
            type: string
            description: The id of the invoice to get the details for
      responses:
        '200':
          description: The Invoice data is successfully retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceResponse'
        '404':
          description: The invoice cannot be found
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    put:
      tags:
        - Invoices
      summary: Update an invoice
      operationId: putInvoice
      parameters:
        - name: id
          in: path
          description: The id of the invoice being updated
          required: true
          schema:
            type: string
            description: The id of the invoice being updated
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateInvoiceRequest'
        required: true
      responses:
        '200':
          description: The request was successful and the invoice was updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /invoices/{id}:void:
    put:
      tags:
        - Invoices
      summary: Void an invoice
      operationId: voidInvoice
      parameters:
        - name: id
          in: path
          description: The id of the invoice
          required: true
          schema:
            type: string
            description: The id of the invoice
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoidInvoiceRequest'
        required: true
      responses:
        '200':
          description: The invoice was voided
        '400':
          description: The invoice can not be voided
        '404':
          description: The invoice does not exist
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /invoices/{id}:mark-as-paid:
    put:
      tags:
        - Invoices
      summary: Manually mark an invoice as paid
      operationId: markInvoiceAsPaid
      parameters:
        - name: id
          in: path
          description: The id of the invoice to be marked as paid
          required: true
          schema:
            type: string
            description: The id of the invoice to be marked as paid
      responses:
        '200':
          description: The invoice was successfully marked as paid
        '404':
          description: The invoice cannot be found
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /invoices/{id}:activate:
    put:
      tags:
        - Invoices
      summary: Activate (send) an invoice
      operationId: activateInvoice
      parameters:
        - name: id
          in: path
          description: The id of the invoice
          required: true
          schema:
            type: string
            description: The id of the invoice
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivateInvoiceRequest'
        required: true
      responses:
        '200':
          description: The invoice was activated
        '400':
          description: The invoice can not be activated
        '404':
          description: The invoice does not exist
  /customers:
    get:
      tags:
        - Customers
      summary: Retrieve a list of customers by filter
      operationId: getCustomers
      parameters:
        - name: onlyCustomersWithActivity
          in: query
          description: >-
            Filter customers that have any financial activity (invoices, direct
            debits)
          required: false
          schema:
            type: string
            description: >-
              Filter customers that have any financial activity (invoices,
              direct debits)
        - name: searchText
          in: query
          description: Fuzzy search a customer based on a text
          required: false
          schema:
            type: string
            description: Fuzzy search a customer based on a text
        - name: ddMandateSignedStartTime
          in: query
          description: >-
            Filter customers that have signed their direct debit mandate after
            this date
          required: false
          schema:
            type: string
            description: >-
              Filter customers that have signed their direct debit mandate after
              this date
        - name: ddMandateSignedEndTime
          in: query
          description: >-
            Filter customers that have signed their direct debit mandate until
            this date
          required: false
          schema:
            type: string
            description: >-
              Filter customers that have signed their direct debit mandate until
              this date
        - name: ddMandateStatuses
          in: query
          description: The status of the latest direct debit mandate
          required: false
          schema:
            type: string
            description: The status of the latest direct debit mandate
        - name: includeCustomerFinancialDetails
          in: query
          description: >-
            This flag determines whether the response should include the
            financial status of the customer's invoices and payments
          required: false
          schema:
            type: string
            description: >-
              This flag determines whether the response should include the
              financial status of the customer's invoices and payments
        - name: financialStatuses
          in: query
          description: The financial statuses of the payment situation of the customer
          required: false
          schema:
            type: string
            description: The financial statuses of the payment situation of the customer
        - name: lastUpdatedStartTime
          in: query
          description: >-
            The start time after which the customer last updated time should be,
            including the start time.
          required: false
          schema:
            type: string
            description: >-
              The start time after which the customer last updated time should
              be, including the start time.
        - name: tagIds
          in: query
          description: The tag ids of the customer
          required: false
          schema:
            type: string
            description: The tag ids of the customer
        - name: customerIds
          in: query
          description: The ids of the customers
          required: false
          schema:
            type: string
            description: The ids of the customers
        - name: page
          in: query
          description: Zero-based page index (0..N)
          required: false
          schema:
            minimum: 0
            type: integer
            default: 0
        - name: size
          in: query
          description: The size of the page to be returned
          required: false
          schema:
            minimum: 1
            type: integer
            default: 20
        - name: sort
          in: query
          description: >-
            Sorting criteria in the format: property,(asc|desc). Default sort
            order is ascending. Multiple sort criteria are supported.
          required: false
          schema:
            type: array
            items:
              type: string
            default:
              - creationTime,DESC
      responses:
        '200':
          description: The list of customers for the specified filter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomersResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required - Invalid or missing authorization headers.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    put:
      tags:
        - Customers
      summary: Update a customer
      operationId: putCustomer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCustomerRequest'
        required: true
      responses:
        '200':
          description: >-
            The request has succeeded and has resulted in one customer being
            updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    post:
      tags:
        - Customers
      summary: Create a customer
      operationId: createCustomer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomerRequest'
        required: true
      responses:
        '200':
          description: >-
            The request has succeeded and has resulted in one customer being
            updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /customers/{id}/directdebitmandates:
    get:
      tags:
        - Direct debit mandates
      summary: Retrieve a direct debit mandates by customer
      operationId: getDirectDebitMandatesByCustomerId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The direct debit mandate attached to the customer with the given id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DirectDebitMandatesResponse'
        '404':
          description: The direct debit mandate doesn't exist
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    put:
      tags:
        - Direct debit mandates
      summary: Create a direct debit mandate
      operationId: create
      parameters:
        - name: id
          in: path
          description: The id of the customer for whom to create the mandate
          required: true
          schema:
            type: string
            description: The id of the customer for whom to create the mandate
      requestBody:
        content:
          application/json:
            schema:
              type: string
              description: The request containing the redirect URL
      responses:
        '200':
          description: The direct debit mandate was created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DirectDebitMandateResponse'
        '400':
          description: Invalid input was provided in the request
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /customers/workflow_settings:
    put:
      tags:
        - Customers
      summary: Upsert customer workflow settings
      operationId: upsertWorkflowSettings
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertCustomerWorkflowSettingsRequest'
        required: true
      responses:
        '200':
          description: The customer workflow settings were successfully updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerWorkflowSettingsResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required - Invalid or missing authorization headers.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /customers/directdebitmandates/{id}:cancel:
    put:
      tags:
        - Direct debit mandates
      summary: Cancel a direct debit mandate
      operationId: cancelDirectDebitMandate
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelDirectDebitMandateRequest'
        required: true
      responses:
        '200':
          description: The direct debit mandate was cancelled.
        '400':
          description: The direct debit mandate can not be cancelled
        '404':
          description: The direct debit mandate doesn't exist
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /apps/{clientId}/webhooks/{webhookId}:
    get:
      tags:
        - Webhooks
      summary: Retrieve a webhook
      operationId: getWebhookById
      parameters:
        - name: clientId
          in: path
          description: The application identifier
          required: true
          schema:
            type: string
            description: The application identifier
        - name: webhookId
          in: path
          description: The webhook identifier
          required: true
          schema:
            type: string
            description: The webhook identifier
      responses:
        '200':
          description: The details of an existing webhook
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookResponse'
        '404':
          description: The application or the webhook does not exist
      security:
        - Platform Bearer Token: []
    put:
      tags:
        - Webhooks
      summary: Update a webhook
      operationId: updateWebhook
      parameters:
        - name: clientId
          in: path
          description: The application identifier
          required: true
          schema:
            type: string
            description: The application identifier
        - name: webhookId
          in: path
          description: The webhook identifier
          required: true
          schema:
            type: string
            description: The webhook identifier
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWebhookRequest'
        required: true
      responses:
        '200':
          description: The updated webhook
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookResponse'
        '400':
          description: Missing required fields
        '404':
          description: The application or the webhook does not exist
      security:
        - Platform Bearer Token: []
    delete:
      tags:
        - Webhooks
      summary: Delete a webhook
      operationId: deleteWebhook
      parameters:
        - name: clientId
          in: path
          description: The application identifier
          required: true
          schema:
            type: string
            description: The application identifier
        - name: webhookId
          in: path
          description: The webhook identifier
          required: true
          schema:
            type: string
            description: The webhook identifier
      responses:
        '204':
          description: The webhook has been deleted
        '404':
          description: The application or the webhook does not exist
      security:
        - Platform Bearer Token: []
  /apps/{clientId}/webhooks/digest:
    put:
      tags:
        - Webhooks
      summary: Generate or replace the webhook signing secret key
      operationId: generateWebhookSecretKey
      parameters:
        - name: clientId
          in: path
          description: The application identifier
          required: true
          schema:
            type: string
            description: The application identifier
      responses:
        '200':
          description: The generated secret key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookDigestResponse'
        '404':
          description: The application does not exist
      security:
        - Platform Bearer Token: []
  /apps/{clientId}/webhooks/auth:
    put:
      tags:
        - Webhooks
      summary: >-
        Create or update the authentication method and credentials for webhook
        target URLs
      operationId: storeWebhookAuthentication
      parameters:
        - name: clientId
          in: path
          description: The application identifier
          required: true
          schema:
            type: string
            description: The application identifier
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookAuthenticationRequest'
        required: true
      responses:
        '204':
          description: The authentication method and details have been stored
        '400':
          description: Missing required fields
        '404':
          description: The application does not exist
      security:
        - Platform Bearer Token: []
  /schedules/payment_requests:
    post:
      tags:
        - Recurring payment requests
      summary: Create a recurring payment request
      operationId: postRecurringPaymentRequest
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRecurringPaymentRequestRequest'
        required: true
      responses:
        '201':
          description: >-
            The request was successful and the recurring payment request was
            created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringPaymentRequestResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /schedules/invoices:
    post:
      tags:
        - Recurring invoices
      summary: Create a recurring invoice
      operationId: postRecurringInvoice
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRecurringInvoiceRequest'
        required: true
      responses:
        '201':
          description: The request was successful and the recurring invoice was created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecurringInvoiceResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /payments:import:
    post:
      tags:
        - Payments
      summary: Import a payment
      description: Import a payment against an invoice with a custom reference.
      operationId: importPayment
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportPaymentRequest'
        required: true
      responses:
        '200':
          description: Payment successfully imported. Returns the created payment records.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportPaymentResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
  /payment_requests:
    get:
      tags:
        - Payment requests
      summary: Retrieve a list of payment requests by filter
      operationId: getPaymentRequests
      parameters:
        - name: customerId
          in: query
          description: The id of the customer associated to the payment request.
          required: false
          schema:
            type: string
            description: The id of the customer associated to the payment request.
        - name: externalCustomerId
          in: query
          description: >-
            The id of the customer from the platform that is integrating with
            Adfin.
          required: false
          schema:
            type: string
            description: >-
              The id of the customer from the platform that is integrating with
              Adfin.
        - name: statuses
          in: query
          description: >-
            The status of the payment request.

            * DRAFT: The payment request does not contain contact details for
            the payer or it is not yet distributed.

            * UNPAID: The payment request is not yet paid.

            * SCHEDULED: The payment request is scheduled to collect the payment
            via Direct Debit.

            * SUBMITTED: The remaining due amount on the payment request is
            covered by submitted (but not yet confirmed) Direct debit payments.

            * PAID: The payment request payment payment is captured.

            * CANCELLED: The payment request is cancelled.

            * SETTLED: THe payment request is paid out
          required: false
          schema:
            type: string
            description: >-
              The status of the payment request.

              * DRAFT: The payment request does not contain contact details for
              the payer or it is not yet distributed.

              * UNPAID: The payment request is not yet paid.

              * SCHEDULED: The payment request is scheduled to collect the
              payment via Direct Debit.

              * SUBMITTED: The remaining due amount on the payment request is
              covered by submitted (but not yet confirmed) Direct debit
              payments.

              * PAID: The payment request payment payment is captured.

              * CANCELLED: The payment request is cancelled.

              * SETTLED: THe payment request is paid out
        - name: associationTypes
          in: query
          description: >-
            Payment request association type.

            * SINGLE - a one off payment request.

            * ONE_TO_ONE - a payment request associated with a single invoice.

            * PARTIAL - a payment request that is associated with an invoice
            that has multiple payment requests (many to one)

            * BATCH - a payment request that is associated with multiple
            invoices (one to many)


            defaults to all types if not specified.
          required: false
          schema:
            type: string
            description: >-
              Payment request association type.

              * SINGLE - a one off payment request.

              * ONE_TO_ONE - a payment request associated with a single invoice.

              * PARTIAL - a payment request that is associated with an invoice
              that has multiple payment requests (many to one)

              * BATCH - a payment request that is associated with multiple
              invoices (one to many)


              defaults to all types if not specified.
        - name: payByStartDate
          in: query
          description: >-
            The start date after which the payment requests pay by date should
            be, including the start date.
          required: false
          schema:
            type: string
            description: >-
              The start date after which the payment requests pay by date should
              be, including the start date.
        - name: payByEndDate
          in: query
          description: >-
            The end date before which the payment requests pay by date should
            be, including the end date.
          required: false
          schema:
            type: string
            description: >-
              The end date before which the payment requests pay by date should
              be, including the end date.
        - name: createdStartDate
          in: query
          description: >-
            The start date after which the payment requests created date should
            be, including the start date.
          required: false
          schema:
            type: string
            description: >-
              The start date after which the payment requests created date
              should be, including the start date.
        - name: createdEndDate
          in: query
          description: >-
            The end date before which the payment requests created date should
            be, including the end date.
          required: false
          schema:
            type: string
            description: >-
              The end date before which the payment requests created date should
              be, including the end date.
        - name: paidStartTime
          in: query
          description: >-
            The start time after which the payment request was paid, including
            the paid start time.
          required: false
          schema:
            type: string
            description: >-
              The start time after which the payment request was paid, including
              the paid start time.
        - name: paidEndTime
          in: query
          description: >-
            The end time after which the payment request was paid, including the
            paid end time.
          required: false
          schema:
            type: string
            description: >-
              The end time after which the payment request was paid, including
              the paid end time.
        - name: lastUpdatedStartTime
          in: query
          description: >-
            The start time after which the payment requests last updated time
            should be, including the start time.
          required: false
          schema:
            type: string
            description: >-
              The start time after which the payment requests last updated time
              should be, including the start time.
        - name: lastUpdatedEndTime
          in: query
          description: >-
            The end time before which the payment requests last updated time
            should be, including the end time.
          required: false
          schema:
            type: string
            description: >-
              The end time before which the payment requests last updated time
              should be, including the end time.
        - name: paymentLinkLastSeenTime
          in: query
          description: The start time before which the payment link was seen.
          required: false
          schema:
            type: string
            description: The start time before which the payment link was seen.
        - name: paymentInitiationDate
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: searchText
          in: query
          description: The text to search for in the payment requests.
          required: false
          schema:
            type: string
            description: The text to search for in the payment requests.
        - name: includeCount
          in: query
          description: >-
            Whether the response should include details on total count and
            counts per statuses
          required: false
          schema:
            type: string
            description: >-
              Whether the response should include details on total count and
              counts per statuses
        - name: creditControlStatuses
          in: query
          description: |
            The credit control status of the payment request.
            * AT_RISK: The payment request is at risk of not being paid.
            * EXPECTED: The payment request is expected to be paid.
            * CONFIRMED: The payment request is paid.
          required: false
          schema:
            type: string
            description: |
              The credit control status of the payment request.
              * AT_RISK: The payment request is at risk of not being paid.
              * EXPECTED: The payment request is expected to be paid.
              * CONFIRMED: The payment request is paid.
        - name: cashflowStatuses
          in: query
          description: |
            The cashflow status of the payment request.
            * UNPAID   – not yet paid.
            * PROCESSING – expected to be paid.
            * PAID_OUT – already paid out.
          required: false
          schema:
            type: string
            description: |
              The cashflow status of the payment request.
              * UNPAID   – not yet paid.
              * PROCESSING – expected to be paid.
              * PAID_OUT – already paid out.
        - name: cashflowPeriodStartDate
          in: query
          description: Start of the cashflow period (inclusive)
          required: false
          schema:
            type: string
            description: Start of the cashflow period (inclusive)
        - name: cashflowPeriodEndDate
          in: query
          description: End of the cashflow period (inclusive)
          required: false
          schema:
            type: string
            description: End of the cashflow period (inclusive)
        - name: directDebitMandateStatuses
          in: query
          description: >
            The direct debit mandate status.

            * NO_MANDATE: payment requests linked to customers without a mandate

            * AWAITING_SIGNATURE: payment requests linked to customers awaiting
            signature

            * SIGNED: payment requests linked to customers with a signed
            mandate, but not yet active

            * ACTIVE: payment requests linked to customers with an active
            mandate.
          required: false
          schema:
            type: string
            description: >
              The direct debit mandate status.

              * NO_MANDATE: payment requests linked to customers without a
              mandate

              * AWAITING_SIGNATURE: payment requests linked to customers
              awaiting signature

              * SIGNED: payment requests linked to customers with a signed
              mandate, but not yet active

              * ACTIVE: payment requests linked to customers with an active
              mandate.
        - name: workflowTypes
          in: query
          description: >
            The workflow type.

            * AUTO_COLLECT: automatic collection workflow, such as direct debit

            * ON_DEMAND: on demain workflow, such as via open banking and card
            payments
          required: false
          schema:
            type: string
            description: >
              The workflow type.

              * AUTO_COLLECT: automatic collection workflow, such as direct
              debit

              * ON_DEMAND: on demain workflow, such as via open banking and card
              payments
        - name: minAmount
          in: query
          description: amount greater than or equal to
          required: false
          schema:
            minimum: 0
            type: string
            description: amount greater than or equal to
        - name: maxAmount
          in: query
          description: amount less than or equal to
          required: false
          schema:
            minimum: 0
            type: string
            description: amount less than or equal to
        - name: scheduleId
          in: query
          description: The id of the schedule associated to the payment request.
          required: false
          schema:
            type: string
            description: The id of the schedule associated to the payment request.
        - name: fieldValueIds
          in: query
          description: >-
            List of field value IDs to filter payment requests by their
            associated field mappings.
          required: false
          schema:
            type: string
            description: >-
              List of field value IDs to filter payment requests by their
              associated field mappings.
        - name: reviewSessionId
          in: query
          description: The review session ID to filter payment requests by
          required: false
          schema:
            type: string
            description: The review session ID to filter payment requests by
        - name: page
          in: query
          description: Zero-based page index (0..N)
          required: false
          schema:
            minimum: 0
            type: integer
            default: 0
        - name: size
          in: query
          description: The size of the page to be returned
          required: false
          schema:
            minimum: 1
            type: integer
            default: 50
        - name: sort
          in: query
          description: >-
            Sorting criteria in the format: property,(asc|desc). Default sort
            order is ascending. Multiple sort criteria are supported.
          required: false
          schema:
            type: array
            items:
              type: string
            default:
              - creationTime,DESC
      responses:
        '200':
          description: The list of payment requests for the specified filter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequestsResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required - Invalid or missing authorization headers.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    post:
      tags:
        - Payment requests
      summary: Create a payment request
      operationId: postPr
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentRequestRequest'
        required: true
      responses:
        '201':
          description: The request was successful and the payment request was created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequestResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '404':
          description: Customer does not exist.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /payment_requests/bulk_import:
    post:
      tags:
        - Payment requests
      summary: Bulk import payment requests
      operationId: bulkImport
      parameters:
        - name: collectionMethod
          in: query
          description: >-
            How the imported payment requests are expected to be collected.
            Currently, only NONE is supported.
          required: true
          schema:
            type: string
            description: >-
              How the imported payment requests are expected to be collected.
              Currently, only NONE is supported.
            example: NONE
          example: NONE
        - name: deleteMissingPaymentRequests
          in: query
          description: >-
            Whether missing payment requests created in previous imports should
            be deleted.
          required: true
          schema:
            type: string
            description: >-
              Whether missing payment requests created in previous imports
              should be deleted.
            example: false
          example: false
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - inputFile
              type: object
              properties:
                inputFile:
                  type: string
                  description: Input file to be processed during the bulk import.
                  format: binary
            examples:
              Bulk Import Request:
                summary: Example bulk import request
                description: >-
                  Upload a input file with payment requests along with
                  collection method and delete flag
                value: |
                  collectionMethod: NONE
                  deleteMissingPaymentRequests: false
                  inputFile: (binary file - payment_requests.csv)
        required: true
      responses:
        '202':
          description: The bulk import request has been accepted for processing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkPaymentRequestImportResponse'
              example:
                jobId: 550e8400-e29b-41d4-a716-446655440000
                type: BULK_PAYMENT_REQUEST_IMPORT
                status: PENDING
                creationTime: '2024-01-15T10:30:00Z'
                countsByItemStatus: []
        '400':
          description: >-
            There was an issue reading or understanding the request. Please
            ensure that it adheres to the required format and includes all
            necessary parameters.
        '401':
          description: Authentication is required.
        '422':
          description: A validation error occurred with the request.
        '500':
          description: The server was unable to process the request.
  /oauth2/token:
    post:
      tags:
        - oAuth2
      summary: Issue an OAuth 2.0 access token
      operationId: issueOAuth2Token
      parameters:
        - name: Authorization
          in: header
          description: The authorization header
          required: false
          schema:
            type: string
            description: The authorization header
        - name: grant_type
          in: query
          required: true
          schema:
            type: string
        - name: client_id
          in: query
          required: false
          schema:
            type: string
        - name: client_secret
          in: query
          required: false
          schema:
            type: string
        - name: code
          in: query
          required: false
          schema:
            type: string
        - name: refresh_token
          in: query
          required: false
          schema:
            type: string
        - name: redirect_uri
          in: query
          required: false
          schema:
            type: string
        - name: scope
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: Access token was successfully issued.
          content:
            application/json:
              examples:
                AccessTokenExample:
                  summary: Example OAuth2 token response
                  description: AccessTokenExample
                  value:
                    access_token: >-
                      eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjV0ZGx6cUxiZ3ZVTXJ6SC1WZVZrZyJ9.eyJpc3MiOiJodHRwczovL2F1dGhlbnRpY2F0aW9uLnN0YWdpbmcuYWRmaW4uY29tLyIsInN1YiI6IkpkandtWEZPMXdqOGN2OXFtbEhFM2xoaVpVZWFqTlpYQGNsaWVudHMiLCJhdWQiOiJodHRwczovL3N0YWdpbmctYXV0aC1hZGZpbi5ldS5hdXRoMC5jb20vYXBpL3YyLyIsImlhdCI6MTc2MTI5NjA2NiwiZXhwIjoxNzYxMzAzMjY2LCJzY29wZSI6ImNyZWF0ZTpjbGllbnRfY3JlZGVudGlhbHMgcmVhZDpjbGllbnRfY3JlZGVudGlhbHMgdXBkYXRlOmNsaWVudF9jcmVkZW50aWFscyBkZWxldGU6Y2xpZW50X2NyZWRlbnRpYWxzIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIiwiYXpwIjoiSmRqd21YRk8xd2o4Y3Y5cW1sSEUzbGhpWlVlYWpOWlgifQ.V2K-38NuyrDkTlu5-4b8g3oIrPWjT8ESIJ7DqB9iawwjYsLGGCU1sPxIK974l6GQVRdF904IeDdLBJc4bLR-G0odtcTM9_SQpHFeZOTUi9WhIh-T_v81VvAN6j_OTW2qA30LfSGPQHJD6Z0fAAHpWqLVkFksuifCxi7LyJ6ufCI9FtoYz6XsG_AMaSbk71dEoc56ChjskXCofi5fmgDH1jZukj_oyzk00IURTpzmB3DjhZI_3TrDTk5tXjxmORiLM8yakJji6s0vqNxSGHUSWxCuMObbCrqeq7jYaUMzPDMhfwllBsGw5tQf1iAA1LUWgNRDjNgTqeY3Mk5oZVTEST
                    expires_in: 7200
                    token_type: Bearer
  /oauth2/revoke:
    post:
      tags:
        - oAuth2
      summary: Revoke an OAuth2 Refresh token
      operationId: revokeOAuth2RefreshToken
      parameters:
        - name: Authorization
          in: header
          description: The authorization header
          required: false
          schema:
            type: string
            description: The authorization header
        - name: client_id
          in: query
          required: false
          schema:
            type: string
        - name: client_secret
          in: query
          required: false
          schema:
            type: string
        - name: token
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The Refresh token was successfully revoked.
  /oauth2/authorize:
    post:
      tags:
        - oAuth2
      summary: Authorize an app to access Adfin data on behalf of an Adfin user
      operationId: authorize
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthorizeRequest'
        required: true
      responses:
        '200':
          description: The app was successfully authorized.
          content:
            application/json:
              examples:
                AuthorizeExample:
                  summary: Example OAuth2 authorization response
                  description: AuthorizeExample
                  value:
                    refresh_token: >-
                      v1.M03zAQtQuGE7AJbgcmSGIAZ9-j7IPRDJEgF_QzXHLn4gJR7yLb-RX6Ir8Q6n-pWzm9jXIvtmR8L46TnZxfTvSCc
                    access_token: >-
                      eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjV0ZGx6cUxiZ3ZVTXJ6SC1WZVZrZyJ9.eyJwbGF0Zm9ybUNsaWVudElkIjoiUUlpdHVaNG44SFo5cktVeXBObTNRSFR1NmtNVFY2UFYiLCJpc3MiOiJodHRwczovL2F1dGhlbnRpY2F0aW9uLnN0YWdpbmcuYWRmaW4uY29tLyIsInN1YiI6ImF1dGgwfDY4MjYxZWIzOTA0NDg5ZjNmZGQxMDYyMCIsImF1ZCI6WyJodHRwczovL3N0YWdpbmctYXV0aDAtYXBpLmFkZmluLmNvbSJdLCJpYXQiOjE3NjEzMDkyNDUsImV4cCI6MTc2MTMxMjg0NSwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCBwaG9uZSBvZmZsaW5lX2FjY2VzcyIsImd0eSI6WyJyZWZyZXNoX3Rva2VuIiwicGFzc3dvcmQiXSwiYXpwIjoiTTlrNDdOZmlSeGIwOEVKakNKQWJGbm5mNnZLZE1GUDUiLCJwZXJtaXNzaW9ucyI6W119.bGCs_5Nh9q1aH_StRTJXMxlYzsAO-ROVi3Ttxh1NtlX6ginnIIzEvdLuY1iJWZ_4sFRuxIzX82mdbbFpuEGOIBoMDfqUOwGMnKY3A0z2366GkWuPT0L3Vd2iUH8Th_if9SnOKMIi_WWopaSuE_pyPtu_LuX1d5zUI70pXiYifRZL51qhDOCEx1rftHfH30GbSeZekVoe4m3Ap5I5f6MD7c03MxSa_oxw-V2keA6W_v1JJGMvXAKI5eqa3vaXW94RkbMbSh0ey6TMNXDyW-u2lCVbjrhGLVs16qMNEtSUaCcmToJ22Wi35Z4xlsv0FOLR9WbMWRmIrjr5BvQxQ2MNtA
                    expires_in: 3600
                    token_type: Bearer
  /invoices:
    get:
      tags:
        - Invoices
      summary: Retrieve a list of invoices by filter
      operationId: getInvoices
      parameters:
        - name: invoiceNo
          in: query
          description: The invoice number.
          required: false
          schema:
            type: string
            description: The invoice number.
        - name: customerId
          in: query
          description: The id of the customer associated to the invoice.
          required: false
          schema:
            type: string
            description: The id of the customer associated to the invoice.
        - name: externalCustomerId
          in: query
          description: >-
            The id of the customer from the platform that is integrating with
            Adfin.
          required: false
          schema:
            type: string
            description: >-
              The id of the customer from the platform that is integrating with
              Adfin.
        - name: statuses
          in: query
          description: >-
            The status of the invoice.

            * DRAFT: The invoice does not contain contact details for the payer
            or it is not yet distributed.

            * UNPAID: The invoice is not yet paid.

            * OVERDUE: The invoice is not yet paid and it is passed the due
            date.

            * SCHEDULED: The invoice is scheduled to collect the payment via
            Direct Debit.

            * SUBMITTED: The remaining due amount on the invoice is covered by
            submitted (but not yet confirmed) Direct Debit payments.

            * PAID: The invoice payment has been captured.

            * SETTLED: The invoice is paid out.

            * VOID: The invoice was voided.
          required: false
          schema:
            type: string
            description: >-
              The status of the invoice.

              * DRAFT: The invoice does not contain contact details for the
              payer or it is not yet distributed.

              * UNPAID: The invoice is not yet paid.

              * OVERDUE: The invoice is not yet paid and it is passed the due
              date.

              * SCHEDULED: The invoice is scheduled to collect the payment via
              Direct Debit.

              * SUBMITTED: The remaining due amount on the invoice is covered by
              submitted (but not yet confirmed) Direct Debit payments.

              * PAID: The invoice payment has been captured.

              * SETTLED: The invoice is paid out.

              * VOID: The invoice was voided.
        - name: statusReasons
          in: query
          description: The status reason codes of the invoice.
          required: false
          schema:
            type: string
            description: The status reason codes of the invoice.
        - name: dueStartDate
          in: query
          description: >-
            The start date after which the invoices due date should be,
            including the start date.
          required: false
          schema:
            type: string
            description: >-
              The start date after which the invoices due date should be,
              including the start date.
        - name: dueEndDate
          in: query
          description: >-
            The end date before which the invoices due date should be, including
            the end date.
          required: false
          schema:
            type: string
            description: >-
              The end date before which the invoices due date should be,
              including the end date.
        - name: issueStartDate
          in: query
          description: >-
            The start date after which the invoices issue date should be,
            including the start date.
          required: false
          schema:
            type: string
            description: >-
              The start date after which the invoices issue date should be,
              including the start date.
        - name: issueEndDate
          in: query
          description: >-
            The end date before which the invoices issue date should be,
            including the end date.
          required: false
          schema:
            type: string
            description: >-
              The end date before which the invoices issue date should be,
              including the end date.
        - name: paidStartTime
          in: query
          description: >-
            The start time after which the invoice was paid, including the paid
            start time.
          required: false
          schema:
            type: string
            description: >-
              The start time after which the invoice was paid, including the
              paid start time.
        - name: paidEndTime
          in: query
          description: >-
            The end time after which the invoice was paid, including the paid
            end time.
          required: false
          schema:
            type: string
            description: >-
              The end time after which the invoice was paid, including the paid
              end time.
        - name: lastUpdatedStartTime
          in: query
          description: >-
            The start time after which the invoices last updated time should be,
            including the start time.
          required: false
          schema:
            type: string
            description: >-
              The start time after which the invoices last updated time should
              be, including the start time.
        - name: lastUpdatedEndTime
          in: query
          description: >-
            The end time before which the invoices last updated time should be,
            including the end time.
          required: false
          schema:
            type: string
            description: >-
              The end time before which the invoices last updated time should
              be, including the end time.
        - name: paymentLinkLastSeenTime
          in: query
          description: The start time before which the payment link was seen.
          required: false
          schema:
            type: string
            description: The start time before which the payment link was seen.
        - name: searchText
          in: query
          description: The text to search for in the invoices.
          required: false
          schema:
            type: string
            description: The text to search for in the invoices.
        - name: includeCount
          in: query
          description: >-
            Whether the response should include details on total count and
            counts per statuses
          required: false
          schema:
            type: string
            description: >-
              Whether the response should include details on total count and
              counts per statuses
        - name: creditControlStatuses
          in: query
          description: |
            The credit control status of the invoice.
            * AT_RISK: The invoice is at risk of not being paid.
            * EXPECTED: The invoice is expected to be paid.
            * CONFIRMED: The invoice is paid.
          required: false
          schema:
            type: string
            description: |
              The credit control status of the invoice.
              * AT_RISK: The invoice is at risk of not being paid.
              * EXPECTED: The invoice is expected to be paid.
              * CONFIRMED: The invoice is paid.
        - name: cashflowStatuses
          in: query
          description: |
            The cashflow status of the payment request.
            * UNPAID   – not yet paid.
            * PROCESSING – expected to be paid.
            * PAID_OUT – already paid out.
          required: false
          schema:
            type: string
            description: |
              The cashflow status of the payment request.
              * UNPAID   – not yet paid.
              * PROCESSING – expected to be paid.
              * PAID_OUT – already paid out.
        - name: cashflowPeriodStartDate
          in: query
          description: Start of the cashflow period (inclusive)
          required: false
          schema:
            type: string
            description: Start of the cashflow period (inclusive)
        - name: cashflowPeriodEndDate
          in: query
          description: End of the cashflow period (inclusive)
          required: false
          schema:
            type: string
            description: End of the cashflow period (inclusive)
        - name: directDebitMandateStatuses
          in: query
          description: >
            The direct debit mandate status.

            * NO_MANDATE: invoices linked to customers without a mandate

            * AWAITING_SIGNATURE: invoices linked to customers awaiting
            signature

            * SIGNED: invoices linked to customers with a signed mandate, but
            not yet active

            * ACTIVE: invoices linked to customers with an active mandate.

            * MIGRATING: invoices linked to customers with an active mandate
            which is being migrated to a different payment service provider.
          required: false
          schema:
            type: string
            description: >
              The direct debit mandate status.

              * NO_MANDATE: invoices linked to customers without a mandate

              * AWAITING_SIGNATURE: invoices linked to customers awaiting
              signature

              * SIGNED: invoices linked to customers with a signed mandate, but
              not yet active

              * ACTIVE: invoices linked to customers with an active mandate.

              * MIGRATING: invoices linked to customers with an active mandate
              which is being migrated to a different payment service provider.
        - name: workflowTypes
          in: query
          description: >
            The workflow type.

            * AUTO_COLLECT: automatic collection workflow, such as direct debit

            * ON_DEMAND: on demain workflow, such as via open banking and card
            payments
          required: false
          schema:
            type: string
            description: >
              The workflow type.

              * AUTO_COLLECT: automatic collection workflow, such as direct
              debit

              * ON_DEMAND: on demain workflow, such as via open banking and card
              payments
        - name: minAmount
          in: query
          description: amount greater than or equal to
          required: false
          schema:
            minimum: 0
            type: string
            description: amount greater than or equal to
        - name: maxAmount
          in: query
          description: amount less than or equal to
          required: false
          schema:
            minimum: 0
            type: string
            description: amount less than or equal to
        - name: reviewSessionId
          in: query
          description: The review session ID to filter invoices by
          required: false
          schema:
            type: string
            description: The review session ID to filter invoices by
        - name: invoiceIds
          in: query
          description: List of invoice IDs to filter by
          required: false
          schema:
            type: string
            description: List of invoice IDs to filter by
        - name: scheduleId
          in: query
          description: The id of the schedule associated to the invoice.
          required: false
          schema:
            type: string
            description: The id of the schedule associated to the invoice.
        - name: fieldValueIds
          in: query
          description: >-
            List of field value IDs to filter invoices by their associated field
            mappings.
          required: false
          schema:
            type: string
            description: >-
              List of field value IDs to filter invoices by their associated
              field mappings.
        - name: page
          in: query
          description: Zero-based page index (0..N)
          required: false
          schema:
            minimum: 0
            type: integer
            default: 0
        - name: size
          in: query
          description: The size of the page to be returned
          required: false
          schema:
            minimum: 1
            type: integer
            default: 50
        - name: sort
          in: query
          description: >-
            Sorting criteria in the format: property,(asc|desc). Default sort
            order is ascending. Multiple sort criteria are supported.
          required: false
          schema:
            type: array
            items:
              type: string
            default:
              - creationTime,DESC
      responses:
        '200':
          description: The list of invoices for the specified filter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required - Invalid or missing authorization headers.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    post:
      tags:
        - Invoices
      summary: Create an invoice
      operationId: createInvoice
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInvoiceRequest'
        required: true
      responses:
        '200':
          description: The request was successful and the invoice was created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /apps/{clientId}/webhooks:
    get:
      tags:
        - Webhooks
      summary: Retrieve webhooks for a clientId
      operationId: getWebhooks
      parameters:
        - name: clientId
          in: path
          description: The application identifier
          required: true
          schema:
            type: string
            description: The application identifier
      responses:
        '200':
          description: A list of existing webhooks
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhooksResponse'
        '404':
          description: The application does not exist
      security:
        - Platform Bearer Token: []
    post:
      tags:
        - Webhooks
      summary: Create a webhook
      operationId: createWebhook
      parameters:
        - name: clientId
          in: path
          description: The application identifier
          required: true
          schema:
            type: string
            description: The application identifier
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
        required: true
      responses:
        '201':
          description: The created webhook
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookResponse'
        '400':
          description: Missing required fields
        '404':
          description: The application or the webhook does not exist
      security:
        - Platform Bearer Token: []
  /biller:
    get:
      tags:
        - Biller
      summary: Retrieves a biller
      description: >-
        Fetches the details of the authenticated user's associated biller.
        Returns a 404 if no biller is found.
      operationId: getBiller
      responses:
        '200':
          description: The biller details retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillerResponse'
        '404':
          description: The biller is not found
        '500':
          description: Something went wrong processing your request
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
    patch:
      tags:
        - Biller
      summary: Patch a Biller
      description: Applies JSON Patch operations to update specific biller fields.
      operationId: patchBiller
      requestBody:
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/PatchBillerRequest'
        required: true
      responses:
        '204':
          description: The biller was successfully patched.
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '404':
          description: Biller not found.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /payment_requests/bulk_import/{jobId}:
    get:
      tags:
        - Payment requests
      summary: Retrieve bulk payment request import job details
      operationId: getBulkPaymentRequestImportJobDetails
      parameters:
        - name: jobId
          in: path
          description: The ID of the bulk payment request import job
          required: true
          schema:
            type: string
            description: The ID of the bulk payment request import job
      responses:
        '200':
          description: >-
            The bulk payment request import job details were successfully
            retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkPaymentRequestImportResponse'
              example:
                jobId: 550e8400-e29b-41d4-a716-446655440000
                type: BULK_PAYMENT_REQUEST_IMPORT
                status: COMPLETED
                creationTime: '2024-01-15T10:30:00Z'
                countsByItemStatus:
                  - status: COMPLETED
                    count: 150
                  - status: PROCESSING
                    count: 5
        '400':
          description: >-
            There was an issue reading or understanding the request. Please
            ensure that it adheres to the required format and includes all
            necessary parameters.
        '401':
          description: Authentication is required.
        '404':
          description: Bulk payment request import job not found.
        '422':
          description: A validation error occurred with the request.
        '500':
          description: The server was unable to process the request.
  /payment_requests/bulk_import/{jobId}/items:
    get:
      tags:
        - Payment requests
      summary: Retrieve bulk payment request import job items
      operationId: getBulkPaymentRequestImportJobItems
      parameters:
        - name: jobId
          in: path
          description: The ID of the bulk payment request import job
          required: true
          schema:
            type: string
            description: The ID of the bulk payment request import job
        - name: statuses
          in: query
          description: |
            The status of the bulk payment request import job item
            * PENDING: The item is still to be processed.
            * PROCESSING: The item is currently processing.
            * COMPLETED: The item has been processed.
            * FAILED: The item has failed to be processed.
          required: false
          schema:
            type: string
            description: |
              The status of the bulk payment request import job item
              * PENDING: The item is still to be processed.
              * PROCESSING: The item is currently processing.
              * COMPLETED: The item has been processed.
              * FAILED: The item has failed to be processed.
        - name: page
          in: query
          description: Zero-based page index (0..N)
          required: false
          schema:
            minimum: 0
            type: integer
            default: 0
        - name: size
          in: query
          description: The size of the page to be returned
          required: false
          schema:
            minimum: 1
            type: integer
            default: 20
        - name: sort
          in: query
          description: >-
            Sorting criteria in the format: property,(asc|desc). Default sort
            order is ascending. Multiple sort criteria are supported.
          required: false
          schema:
            type: array
            items:
              type: string
            default:
              - creationTime,ASC
      responses:
        '200':
          description: >-
            Paginated response for the list of bulk payment request import job
            items
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkPaymentRequestImportItemsResponse'
              example:
                items:
                  - id: 123e4567-e89b-12d3-a456-426614174000
                    jobId: 550e8400-e29b-41d4-a716-446655440000
                    paymentRequestNo: PR-2024-001
                    bulkPrImportOperation: UPSERT
                    status: FAILED
                    statusReason: Operation has failed
                    creationTime: '2024-01-15T10:30:00Z'
                  - id: 223e4567-e89b-12d3-a456-426614174001
                    jobId: 550e8400-e29b-41d4-a716-446655440000
                    paymentRequestNo: PR-2024-002
                    bulkPrImportOperation: DELETE
                    status: PENDING
                    creationTime: '2024-01-15T10:30:01Z'
                pagination:
                  page: 0
                  size: 20
                  totalElements: 155
                  totalPages: 8
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required - Invalid or missing authorization headers.
        '404':
          description: Bulk payment request import job not found.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
  /oauth2/authorization:
    get:
      tags:
        - oAuth2
      summary: Get the authorization details for an app
      operationId: getAppAuthorizationDetails
      parameters:
        - name: clientId
          in: query
          required: false
          schema:
            type: string
        - name: state
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: The app was successfully retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppResponse'
        '404':
          description: No app was found with the provided client id
  /invoices/{id}/file:
    get:
      tags:
        - Invoices
      summary: Get the file for a specific invoice
      operationId: getFile
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The invoice file is successfully returned
          content:
            application/octet-stream:
              schema:
                $ref: '#/components/schemas/StreamingResponseBody'
        '404':
          description: The invoice cannot be found
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /customers/{id}:
    get:
      tags:
        - Customers
      summary: Retrieve a customer
      operationId: getCustomerById
      parameters:
        - name: id
          in: path
          description: The id of the customer to get the details for
          required: true
          schema:
            type: string
            description: The id of the customer to get the details for
        - name: idType
          in: query
          description: The connector type that this ID refers to
          required: true
          schema:
            type: string
            description: The connector type that this ID refers to
        - name: includeCustomerFinancialDetails
          in: query
          description: >-
            This flag determines whether the response should include the
            financial status of the customer's invoices and payments.
          required: false
          schema:
            type: string
            description: >-
              This flag determines whether the response should include the
              financial status of the customer's invoices and payments.
      responses:
        '200':
          description: The customer with the specified ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required - Invalid or missing authorization headers.
        '422':
          description: A request validation error.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /customers/{id}/workflow_settings:
    get:
      tags:
        - Customers
      summary: Retrieve customer workflow settings
      operationId: getWorkflowSettings
      parameters:
        - name: id
          in: path
          description: The id of the customer to get workflow settings for
          required: true
          schema:
            type: string
            description: The id of the customer to get workflow settings for
      responses:
        '200':
          description: The workflow settings were retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerWorkflowSettingsResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required - Invalid or missing authorization headers.
        '500':
          description: The server could not process the request.
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /customers/directdebitmandates/{id}:
    get:
      tags:
        - Direct debit mandates
      summary: Retrieve a direct debit mandate
      operationId: getDirectDebitMandate
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The direct debit mandate corresponding to the provided id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DirectDebitMandateResponse'
        '404':
          description: The direct debit mandate doesn't exist
      security:
        - Biller Access Token (Staging): []
        - Biller Access Token (Production): []
  /catalogs/tax_rates:
    get:
      tags:
        - Tax rates
      summary: Retrieve tax rate options
      operationId: getTaxRateCataloguesForBiller
      parameters:
        - name: connectorType
          in: query
          required: false
          schema:
            type: string
            description: >-
              The connector type. 

              Possible values (non-exclusive): XERO, QUICKBOOKS, BRIDGE, STRIPE,
              PLATFORM
      responses:
        '200':
          description: >-
            The request has succeeded and has resulted in a list of tax rate
            options
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTaxRateCatalogueResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '500':
          description: The server could not process the request.
  /catalogs/items:
    get:
      tags:
        - Items
      summary: Get line item catalogue items for a given filter
      operationId: postLineItemCatalogueElement
      parameters:
        - name: description
          in: query
          description: Item description
          required: false
          schema:
            type: string
            description: Item description
      responses:
        '200':
          description: >-
            The request has succeeded and has resulted in one line item
            catalogue element created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetLineItemCatalogueResponse'
        '400':
          description: >-
            A problem reading or understanding the request. Ensure that the
            request complies with the required format and includes all necessary
            parameters.
        '401':
          description: Authentication required.
        '500':
          description: The server could not process the request.
components:
  schemas:
    CreateWorkflowRequest:
      required:
        - type
      type: object
      properties:
        id:
          type: string
          description: The internal identifier of the schedule. Required only for updates.
        templateId:
          type: string
          description: >-
            The internal id of the template to be used for defining the
            schedule. Can be used in place of defining individual events for a
            schedule; in this case, the events will be automatically copied from
            the template. This streamlines the process and ensures consistency
            across schedules.
        customerDetails:
          $ref: '#/components/schemas/CustomerDetails'
        invoiceDetails:
          $ref: '#/components/schemas/InvoiceDetails'
        name:
          maxLength: 50
          minLength: 0
          type: string
          description: >-
            The name of the schedule to be created for the customer. It must
            contain only alphanumeric characters, and be limited to a maximum of
            50 characters.
        type:
          type: string
          description: >-
            The type of the schedule to be created for the customer. 

            Possible values (non-exclusive): ONE_TIME_PAYMENT,
            DD_MANDATE_AUTHORISATION, DD_PAYMENT, CUSTOMER_STATEMENT
        customMessage:
          type: string
          description: The (optional) custom message to be added to notification
        events:
          type: array
          description: >-
            A list of events that will occur as part of the schedule, applicable
            exclusively to a single customer
          items:
            $ref: '#/components/schemas/EventRequest'
        settings:
          $ref: '#/components/schemas/WorkflowSettingsRequest'
    CustomerDetails:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          description: The Adfin ID of the customer.
          example: 80349480-490b-4234-92e7-fad697e3d446
      description: |
        Contains the unique identifier for the customer.
      example:
        id: 80349480-490b-4234-92e7-fad697e3d446
    CustomerStatementSettings:
      required:
        - isEnabled
      type: object
      properties:
        isEnabled:
          type: boolean
          description: Indicates whether customer statement workflow is enabled
      description: Customer statement workflow settings
    Duration:
      type: object
      properties:
        startDate:
          type: string
          description: The date when the event execution will begin
          format: date-time
        endDate:
          type: string
          description: The date on which the execution of the event will conclude
          format: date-time
        maxNoOfExecutions:
          type: integer
          description: The maximum allowable executions of an event
          format: int32
      description: The event duration
    EventRequest:
      type: object
      properties:
        frequency:
          $ref: '#/components/schemas/Frequency'
        duration:
          $ref: '#/components/schemas/Duration'
        trigger:
          $ref: '#/components/schemas/RelativeDateTrigger'
        relativeDateTrigger:
          $ref: '#/components/schemas/RelativeDateTrigger'
        ordinalWeekdayTrigger:
          $ref: '#/components/schemas/OrdinalWeekdayTrigger'
        type:
          type: string
          description: >-
            Attribute that specifies the type of event. 

            Possible values (non-exclusive): NO_ACTION, SEND_NOTIFICATION,
            MAKE_PAYMENT, UPDATE_DIRECT_DEBIT_PAYMENTS, SEND_DD_INVOICE_NOTICE,
            SEND_DD_COLLECTION_NOTICE, SEND_DD_SUCCESS_COLLECTION_NOTICE,
            SEND_DD_FAILED_COLLECTION_NOTICE, START_FALLBACK_WORKFLOW,
            SEND_MANDATE_AUTHORISATION_NOTIFICATION, CREATE_DD_MANDATE,
            PREVIEW_CHARGE_DATE, PREVIEW_PAYOUT_DATE,
            SEND_CUSTOMER_STATEMENT_NOTIFICATION
        details:
          type: object
          description: >-
            Attribute used for defining details related to an event. Can be
            utilized to create a new invoice request. This flexibility allows to
            tailor schedules effectively, ensuring that the appropriate
            information and formats are used for each scenario
      description: >-
        A list of events that will occur as part of the schedule, applicable
        exclusively to a single customer
    Frequency:
      type: object
      properties:
        timeUnit:
          type: string
          description: >-
            Time unit measurements used to define the frequency of events. 

            Possible values (non-exclusive): SECOND, MINUTE, HOUR, DAY, WEEK,
            MONTH, YEAR, MONTH, WEEK, DAY
        frequency:
          type: integer
          description: The frequency of the time units
          format: int32
        dayOfMonth:
          type: integer
          description: >-
            The specific day of the month designated for executing the event.
            Please note that short month handling is applicable; if the value is
            set to 29, 30, or 31, the execution will occur on the last day of
            the month when applicable
          format: int32
      description: The event frequency
    InvoiceDetails:
      type: object
      properties:
        id:
          type: string
          description: The internal id of the invoice
        invoiceNo:
          type: string
          description: >-
            The number of the invoice. Unique value that can be used as
            idempotency key
        description:
          type: string
          description: Short description of the invoice
        totalAmount:
          type: string
          description: >-
            The invoice total amount. Includes tax amount, amount paid or
            reduced with credit notes)
        taxAmount:
          type: string
          description: The invoice tax amount.
        dueAmount:
          type: string
          description: The invoice amount due (remaining to be paid).
        creditNotesAmount:
          type: string
          description: The total amount that is credited.
        dueDate:
          type: string
          description: The due date of the invoice
          format: date-time
        issueDate:
          type: string
          description: The issue date date of the invoice
          format: date-time
        creationTime:
          type: string
          description: The date the invoice was created
          format: date-time
        lastUpdatedTime:
          type: string
          description: The date the invoice was last updated
          format: date-time
        paidTime:
          type: string
          description: The date the invoice was paid
          format: date-time
        status:
          type: string
          description: >-
            The status of the invoice.

            * DRAFT: The invoice is created, but not yet activated (sent)

            * UNPAID: The invoice is not yet paid.

            * SCHEDULED: The invoice is scheduled to collect the payment via
            Direct Debit.

            * SUBMITTED: The remaining due amount on the invoice is covered by
            submitted (but not yet confirmed) Direct Debit payments.

            * OVERDUE: The invoice is not yet paid and it is passed the due
            date.

            * PAID: The invoice payment has been captured.

            * SETTLED: The invoice is paid out.

            * VOID: The invoice was voided.. 

            Possible values (non-exclusive): DRAFT, UNPAID, OVERDUE, SCHEDULED,
            SUBMITTED, PAID, VOID, SETTLED
        statusReasonCode:
          type: string
          description: >-
            The reason why the invoice is in a certain status.

            * MISSING_PAYER_CONTACT_DETAILS - The invoice is missing the contact
            details of payer.

            * PENDING_ACTIVATION - The invoice is not yet distributed by
            Adfin.. 

            Possible values (non-exclusive): MISSING_PAYER_CONTACT_DETAILS,
            PENDING_ACTIVATION, PENDING_DD_MANDATE, PENDING_DD_CAPABILITY,
            MARKED_AS_PAID, WORKFLOW_COMPLETED, NOTIFICATION_DELIVERY_FAILED,
            BULK_PRUNE, OTHER
        statusReason:
          type: string
          description: Custom details on why the invoice is in a certain status
        itemsTaxType:
          type: string
          description: |-
            Specifies how tax is applied to line items in an invoice.
            * EXCLUSIVE: Line items are exclusive of tax.
            * INCLUSIVE: Line items are inclusive tax.
            * NONE: Line items have no tax.. 
            Possible values (non-exclusive): EXCLUSIVE, INCLUSIVE, NONE
        items:
          type: array
          description: The list of items from the invoice
          items:
            $ref: '#/components/schemas/LineItemResponse'
        creditNotes:
          type: array
          description: The list of credit notes from the invoice
          items:
            $ref: '#/components/schemas/CreditNoteResponse'
        fileSource:
          type: string
          description: >-
            The source of the file currently being served. 

            Possible values (non-exclusive): NONE, FILE_UPLOAD, EXTERNAL, ADFIN,
            PENDING_ADFIN
        invoiceSource:
          type: string
          description: >-
            The source of the invoice. 

            Possible values (non-exclusive): FILE_UPLOAD, MANUAL, PR, EXTERNAL,
            SCHEDULE, PLATFORM
        externalData:
          type: array
          description: >-
            References about this invoice from external platforms Adfin
            integrates with. Such as ID etc
          items:
            $ref: '#/components/schemas/InvoiceExternalData'
      description: Invoice details response object.
    OrdinalWeekdayTrigger:
      required:
        - dayOfWeek
        - ordinal
      type: object
      properties:
        ordinal:
          type: integer
          description: >-
            The ordinal position of the weekday in the month (e.g., 1 for first,
            2 for second, -1 for last)
          format: int32
        dayOfWeek:
          type: string
          description: >-
            The day of the week (MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,
            SATURDAY, SUNDAY)
      description: >-
        Triggers the event based on an ordinal weekday. Mutually exclusive with
        relativeDateTrigger
    RelativeDateTrigger:
      type: object
      properties:
        days:
          type: integer
          description: The number of days before/after sent date
          format: int32
        operator:
          type: string
          description: |-
            The operator used for determining the send date. 
            Possible values (non-exclusive): ON, AFTER, BEFORE
        referenceDate:
          type: string
          description: >-
            The reference date used for computing the date when to execute the
            workflow step. 

            Possible values (non-exclusive): DUE_DATE, SENT_DATE, PAYMENT_DATE
      description: >-
        Triggers the event based on a relative date. Mutually exclusive with
        ordinalWeekdayTrigger
    WorkflowSettingsRequest:
      type: object
      properties:
        customerStatementSettings:
          $ref: '#/components/schemas/CustomerStatementSettings'
      description: Optional workflow specific settings.
    EventResponse:
      type: object
      properties:
        id:
          type: string
          description: The internal id of the created event
        frequency:
          $ref: '#/components/schemas/Frequency'
        duration:
          $ref: '#/components/schemas/Duration'
        trigger:
          $ref: '#/components/schemas/RelativeDateTrigger'
        relativeDateTrigger:
          $ref: '#/components/schemas/RelativeDateTrigger'
        ordinalWeekdayTrigger:
          $ref: '#/components/schemas/OrdinalWeekdayTrigger'
        triggerDate:
          type: string
          description: >-
            The event trigger date computed based on event execution
            configurations
          format: date-time
        type:
          type: string
          description: >-
            The type of event. 

            Possible values (non-exclusive): NO_ACTION, SEND_NOTIFICATION,
            MAKE_PAYMENT, UPDATE_DIRECT_DEBIT_PAYMENTS, SEND_DD_INVOICE_NOTICE,
            SEND_DD_COLLECTION_NOTICE, SEND_DD_SUCCESS_COLLECTION_NOTICE,
            SEND_DD_FAILED_COLLECTION_NOTICE, START_FALLBACK_WORKFLOW,
            SEND_MANDATE_AUTHORISATION_NOTIFICATION, CREATE_DD_MANDATE,
            PREVIEW_CHARGE_DATE, PREVIEW_PAYOUT_DATE,
            SEND_CUSTOMER_STATEMENT_NOTIFICATION
        state:
          type: string
          description: >-
            The current state of the event. 

            Possible values (non-exclusive): SCHEDULED, ACTIVE, PAUSED, SKIPPED,
            FAILED, FINISHED, INACTIVE, DELETED
        details:
          type: object
          description: >-
            Attribute used for defining details related to an event. Can be
            utilized to create a new invoice request. This flexibility allows to
            tailor instances effectively, ensuring that the appropriate
            information and formats are used for each scenario
      description: >-
        The list of events that will occur as part of the workflow, applicable
        exclusively to a single customer
    ReminderSettingsResponse:
      type: object
      properties:
        id:
          type: string
          description: The internal id of the schedule setting
        entityId:
          type: string
          description: >-
            The internal id of the entity for whom this schedule setting was
            created.
        entityType:
          type: string
          description: |-
            Attribute that specifies the type of entity. 
            Possible values (non-exclusive): INVOICE, CUSTOMER
        customerDetails:
          $ref: '#/components/schemas/CustomerDetails'
        creationTime:
          type: string
          description: The creation time of the schedule setting
          format: date-time
        lastUpdatedTime:
          type: string
          description: Last time the schedule setting was updated
          format: date-time
        startTime:
          type: string
          description: The time when the schedule setting activates
          format: date-time
        endTime:
          type: string
          description: The time when the schedule setting expires
          format: date-time
      description: >-
        Scheduled reminder configurations for invoices or customers, defining
        when automated reminders should be sent based on start and end times
    WorkflowResponse:
      required:
        - creationTime
        - id
        - state
        - type
      type: object
      properties:
        id:
          type: string
          description: The internal id of the workflow created
        templateId:
          type: string
          description: >-
            The internal id of the template used to define the workflow. This
            template id has been utilized to automatically copy events into the
            instance, streamlining the process and ensuring consistency
            throughout
        customerDetails:
          $ref: '#/components/schemas/CustomerDetails'
        invoiceDetails:
          $ref: '#/components/schemas/InvoiceDetails'
        name:
          type: string
          description: The name of the workflow created for the customer
        type:
          type: string
          description: >-
            Attribute that specifies the type of workflow. 

            Possible values (non-exclusive): ONE_TIME_PAYMENT,
            DD_MANDATE_AUTHORISATION, DD_PAYMENT, CUSTOMER_STATEMENT
        state:
          type: string
          description: >-
            The current state of the workflow. 

            Possible values (non-exclusive): PENDING, ACTIVE, PAUSED, COMPLETED,
            TERMINATED
        paymentInitiationDate:
          type: string
          description: The payment initiation date of Auto Collect workflows
          format: date-time
        creationTime:
          type: string
          description: The creation time of the workflow
          format: date-time
        lastUpdatedTime:
          type: string
          description: Last time the workflow was updated
          format: date-time
        events:
          type: array
          description: >-
            The list of events that will occur as part of the workflow,
            applicable exclusively to a single customer
          items:
            $ref: '#/components/schemas/EventResponse'
        settings:
          type: array
          description: The settings for reminders
          items:
            $ref: '#/components/schemas/ReminderSettingsResponse'
        workflowSettings:
          $ref: '#/components/schemas/WorkflowSettingsResponse'
    WorkflowSettingsResponse:
      type: object
      properties:
        reminderSettings:
          type: array
          description: >-
            Scheduled reminder configurations for invoices or customers,
            defining when automated reminders should be sent based on start and
            end times
          items:
            $ref: '#/components/schemas/ReminderSettingsResponse'
        customerStatementSettings:
          $ref: '#/components/schemas/CustomerStatementSettings'
      description: Configuration settings related to schedule.
    CollectionDetails:
      required:
        - approvedForSending
      type: object
      properties:
        collectionMethod:
          type: string
          description: >-
            How the payment is expected to be collected.

            For example:

            - `AUTO_COLLECT`: Collected automatically via direct debit.

            - `ON_DEMAND`: Collected via other payment methods (eg. `CARD`,
            `APPLE_PAY`, `GOOGLE_PAY`, `BANK`).

            - `NONE`: No payment collection is initiated automatically.

            . 

            Possible values (non-exclusive): AUTO_COLLECT, ON_DEMAND, NONE
        templateId:
          type: string
          description: >
            The workflow template ID used for sending the invoice or payment
            request to the customer.

            Optional — if null, the system default template will be used.
          format: uuid
          example: d290f1ee-6c54-4b01-90e6-d701748f0851
        customMessage:
          type: string
          description: >
            An optional message that will be sent to the customer when the
            invoice or payment request is distributed.

            Can be used for personalized greetings or additional instructions.
          example: Please find your invoice attached. Thank you!
        approvedForSending:
          type: boolean
          description: >
            Boolean flag specifying whether the invoice or payment request is
            approved for sending.

            Defaults to `true` if not explicitly set.
          default: true
      description: >
        Information about how an invoice or payment request is distributed and
        collected.


        This defines:

        - The method by which payment is expected to be collected.

        - The workflow template used to send the invoice or payment request.

        - Optional custom message for the customer.

        - Approval status for automatically distributing to the customer.
      example:
        collectionMethod: AUTO_COLLECT
        templateId: d290f1ee-6c54-4b01-90e6-d701748f0851
        customMessage: Thank you for your business!
        approvedForSending: true
    IntervalCadence:
      required:
        - frequency
        - startDate
        - timeUnit
      type: object
      properties:
        timeUnit:
          type: string
          description: |
            Determines whether the cadence repeats in weeks, months or years.
            Common values:
            - WEEKS
            - MONTHS
            - YEARS
          example: WEEKS
        frequency:
          minimum: 1
          type: integer
          description: |
            Combined with `timeUnit` to determine how often the cadence occurs.
            For example:
            - `frequency = 2` and `timeUnit = WEEKS` → every 2 weeks
            - `frequency = 1` and `timeUnit = MONTHS` → every month
          format: int32
          example: 2
        startDate:
          type: string
          description: |
            The first occurrence happens at this time.
          format: date-time
          example: '2025-01-01T00:00:00Z'
        endDate:
          type: string
          description: |
            Optional end date for the cadence.
            If provided, the generation stops at or before this date.
            If omitted, the cadence continues indefinitely.
          format: date-time
          example: '2025-12-31T23:59:59Z'
      description: |
        A cadence that recurs at a fixed interval.
        Use this to define schedules that repeat every N units of time,
        such as "every 2 weeks" or "every 3 months".
      example:
        timeUnit: WEEKS
        frequency: 2
        startDate: '2025-01-01T00:00:00Z'
        endDate: '2025-12-31T23:59:59Z'
    PaymentTerm:
      type: object
      properties:
        timeUnit:
          type: string
          description: >-
            The unit of time for the payment term.

            Common values include:

            - `DAYS`

            - `WEEKS`

            - `MONTHS`


            Optional. Defaults to `DAYS` if not provided.

            . 

            Possible values (non-exclusive): SECOND, MINUTE, HOUR, DAY, WEEK,
            MONTH, YEAR
          example: DAYS
        value:
          type: integer
          description: |
            The numeric value of the payment term.
            Combined with `timeUnit` to calculate due dates.
          format: int32
          example: 30
      description: >
        Defines the duration before an invoice is due, using a combination of a
        time unit and value.

        For example, a value of `30` with a `timeUnit` of `DAYS` represents "net
        30 days".
      example:
        timeUnit: DAYS
        value: 30
    RecurringPaymentRequestDetails:
      required:
        - amount
        - currencyCode
        - customer
        - distribution
      type: object
      properties:
        customer:
          $ref: '#/components/schemas/CustomerDetails'
        paymentTerm:
          $ref: '#/components/schemas/PaymentTerm'
        distribution:
          $ref: '#/components/schemas/CollectionDetails'
        amount:
          type: number
          description: >
            The total amount to be collected for each of the payment requests
            generated.
          example: 1200
        taxRate:
          type: number
          description: |
            The INCLUSIVE tax rate (%) applied to the payment request.
          example: 20
        currencyCode:
          type: string
          description: |
            The three-letter ISO 4217 currency code (e.g., `GBP`, `EUR`, `USD`).
            Indicates the currency in which the payment request is issued.
          example: GBP
        description:
          type: string
          description: |
            A short, description of the payment request.
          example: Quarterly service fee
        reference:
          type: string
          description: |
            An optional reference or identifier that links this payment request
            to another system or document.
          example: Q1-2025
      description: >
        Defines the configuration for a **Payment Request (PR)** automatically
        generated.


        This object specifies the customer, collection workflow, currency,
        payment terms for the payment requests.
      example:
        customer:
          id: 80349480-490b-4234-92e7-fad697e3d446
        paymentTerm:
          timeUnit: DAYS
          value: 30
        distribution:
          collectionMethod: AUTO_COLLECT
          templateId: dc9c7c6e-4c12-4cc9-8d22-20c5b2a7f8f7
          customMessage: Please review and confirm payment.
          approvedForSending: true
        amount: 1200
        taxRate: 20
        currencyCode: GBP
        description: Quarterly service fee
        reference: Q1-2025
    UpdateRecurringPaymentRequestRequest:
      type: object
      properties:
        cadence:
          $ref: '#/components/schemas/IntervalCadence'
        paymentRequestDetails:
          $ref: '#/components/schemas/RecurringPaymentRequestDetails'
      description: Update a recurring payment request.
    NewLineItemRequest:
      type: object
      properties:
        description:
          type: string
          description: The description of the item.
        quantity:
          type: number
          description: The quantity of items.
        unitAmount:
          type: number
          description: The price per unit of the item.
        taxRate:
          type: number
          description: >-
            The tax rate percentage applied on the line item amount (quantity *
            unit amount).
        taxRateId:
          type: string
          description: >-
            Tax rate id for this line item. Use the Tax Rates API to manage your
            tax rates.
          example: d4f1c2b3-4a5b-678c-9d0e-f1a2b3c4d5e6
        accountCodeId:
          type: string
          description: >-
            Sales account id for this line item. If you require specific sales
            accounts to be used, provide the account code id here. To recieve
            your account codes, contact support@adfin.com
        productId:
          type: string
          description: >-
            The base product id for this line item. Use the Items catalog API to
            manage your products.
          example: d4f1c2b3-4a5b-678c-9d0e-f1a2b3c4d5e6
      description: Create line items.
      example:
        - description: Monthly Pro Plan Subscription
          unitAmount: 5000
          quantity: 1
        - description: Additional API Usage
          unitAmount: 2000
          quantity: 1
    NextInvoiceResponse:
      type: object
      properties:
        index:
          type: integer
          description: >
            The sequence number of this invoice within the schedule.


            Starts from `1` for the first generated invoice and increments for
            each occurrence.
          format: int32
          example: 3
        issueDate:
          type: string
          description: >
            The date and time when the next invoice will be issued to the
            customer.

            Determined by the cadence configuration.
          format: date-time
          example: '2025-11-01T00:00:00Z'
        dueDate:
          type: string
          description: |
            The date and time when the invoice is due for payment.
            Calculated based on the payment terms.
          format: date-time
          example: '2025-11-08T00:00:00Z'
      description: >
        Represents the next scheduled invoice within a recurring invoice
        schedule.


        This object provides information about when the next invoice will be
        issued

        and when it is due, based on the schedule’s cadence and payment terms.
    RecurringInvoiceDetails:
      required:
        - currencyCode
        - customer
        - distribution
        - items
        - itemsTaxType
      type: object
      properties:
        customer:
          $ref: '#/components/schemas/CustomerDetails'
        paymentTerm:
          $ref: '#/components/schemas/PaymentTerm'
        distribution:
          $ref: '#/components/schemas/CollectionDetails'
        description:
          type: string
          description: |
            A short summary or purpose of the invoice.
            Appears in both the invoice document and customer communications.
          example: Monthly subscription fee for January 2025
        currencyCode:
          type: string
          description: |
            The three-letter ISO 4217 currency code (e.g., `GBP`, `EUR`, `USD`).
            Indicates the currency in which the invoice is issued.
          example: GBP
        itemsTaxType:
          type: string
          description: |
            Defines how tax is applied to the invoice line items.

            Possible values:
            - `INCLUSIVE`: Tax is included in item prices.
            - `EXCLUSIVE`: Tax is added on top of item prices.
            - `NONE`: No tax applied.
          example: INCLUSIVE
        items:
          type: array
          description: >
            The list of line items included in the invoice.

            Each item represents a product, service, or fee with its own amount
            and tax configuration.
          example:
            - description: Monthly Pro Plan Subscription
              unitAmount: 5000
              quantity: 1
            - description: Additional API Usage
              unitAmount: 2000
              quantity: 1
          items:
            $ref: '#/components/schemas/NewLineItemRequest'
      description: >
        This defines the structure and configuration of invoices that will be
        automatically generated.
      example:
        customer:
          id: 80349480-490b-4234-92e7-fad697e3d446
        paymentTerm:
          timeUnit: DAYS
          value: 30
        distribution:
          collectionMethod: AUTO_COLLECT
          templateId: d290f1ee-6c54-4b01-90e6-d701748f0851
          customMessage: Please find your invoice attached. Thank you for your business!
          approvedForSending: true
        description: Monthly subscription for January
        currencyCode: GBP
        itemsTaxType: INCLUSIVE
        items:
          - description: Pro Plan Subscription
            unitAmount: 5000
            quantity: 1
            taxRate: 0.1
    RecurringInvoiceResponse:
      type: object
      properties:
        id:
          type: string
          description: The Adfin ID of the recurring invoice.
          example: '1'
        recurringInvoiceNo:
          type: string
          description: >
            A system-generated, unique identifier for the recurring invoice.

            Automatically created using the prefix SCH followed by a numeric
            sequence (e.g., SCH-1, SCH-2, ...).
          example: SCH-42
        nextIssueDate:
          type: string
          description: The next date a new invoice will be automatically generated.
          format: date-time
          example: '2025-10-15T00:00:00Z'
        status:
          type: string
          description: >
            Indicates the current status of the recurring invoice.

            Possible values might include:

            - `DRAFT` – currently not generating new invoices

            - `ACTIVE` – currently generating new invoices

            - `FINISHED` – has finished all planned occurrences

            - `CANCELLED` – has been cancelled before finishing all planned
            occurrences
          example: ACTIVE
        cadence:
          $ref: '#/components/schemas/IntervalCadence'
        invoiceDetails:
          $ref: '#/components/schemas/RecurringInvoiceDetails'
        creationTime:
          type: string
          description: The date and time when the recurring invoice was created.
          format: date-time
          example: '2025-09-27T12:00:00Z'
        lastUpdatedTime:
          type: string
          description: The date and time when the recurring invoice was last updated.
          format: date-time
          example: '2025-10-01T08:30:00Z'
        totalInvoices:
          type: integer
          description: >
            The total number of invoices this recurring invoice is expected to
            generate

            based on cadence, start date, and end date.
          format: int32
          example: 10
        amount:
          type: number
          description: >
            The total amount of the recurring invoice.

            Calculated based on the sum of all invoice line items across all
            occurrences.
          example: 1234.5
        nextInvoices:
          type: array
          description: |
            A list of upcoming invoices to be generated.
            Ordered by index and date, and limited to a maximum of 12 items.
          items:
            $ref: '#/components/schemas/NextInvoiceResponse'
      description: >
        A schedule that defines when and how invoices are automatically
        generated for a customer,

        including cadence, payment terms, items, etc..
    NextPaymentRequestResponse:
      type: object
      properties:
        index:
          type: integer
          description: >
            The sequence number of this payment request within the schedule.


            Starts from `1` for the first generated payment request and
            increments for each occurrence.
          format: int32
          example: 3
        issueDate:
          type: string
          description: >
            The date and time when the next payment request will be issued to
            the customer.

            Determined by the cadence configuration.
          format: date-time
          example: '2025-11-01T00:00:00Z'
        payByDate:
          type: string
          description: |
            The date and time when the payment request is due for payment.
            Calculated based on the payment terms.
          format: date-time
          example: '2025-11-08T00:00:00Z'
      description: >
        Represents the next scheduled payment request within a recurring payment
        request schedule.


        This object provides information about when the next payment request
        will be issued

        and when it is due, based on the schedule’s cadence and payment terms.
    RecurringPaymentRequestResponse:
      type: object
      properties:
        id:
          type: string
          description: The Adfin ID of the recurring payment request.
          example: '1'
        recurringPaymentRequestNo:
          type: string
          description: >
            A system-generated, unique identifier for the recurring payment
            request.

            Automatically created using the prefix SCH followed by a numeric
            sequence (e.g., SCH-1, SCH-2, ...).
          example: SCH-42
        nextDate:
          type: string
          description: The next date a new payment request will be generated.
          format: date-time
          example: '2025-10-15T00:00:00Z'
        status:
          type: string
          description: >
            Indicates the current status of the recurring payment request.

            Possible values might include:

            - `ACTIVE` – currently generating new payment request

            - `FINISHED` – has finished all planned occurrences

            - `CANCELLED` – has been cancelled before finishing all planned
            occurrences
          example: ACTIVE
        cadence:
          $ref: '#/components/schemas/IntervalCadence'
        paymentRequestDetails:
          $ref: '#/components/schemas/RecurringPaymentRequestDetails'
        creationTime:
          type: string
          description: The date and time when the recurring payment request was created.
          format: date-time
          example: '2025-09-27T12:00:00Z'
        lastUpdatedTime:
          type: string
          description: >-
            The date and time when the recurring payment request was last
            updated.
          format: date-time
          example: '2025-10-01T08:30:00Z'
        totalPaymentRequests:
          type: integer
          description: >
            The total number of payment requests this recurring payment request
            is expected to generate

            based on cadence, start date, and end date.
          format: int32
          example: 10
        nextPaymentRequests:
          type: array
          description: |
            A list of upcoming payment requests to be generated.
            Ordered by index and date, and limited to a maximum of 12 items.
          items:
            $ref: '#/components/schemas/NextPaymentRequestResponse'
      description: >
        A schedule that defines when and how payment request are automatically
        generated for a customer,

        including cadence, payment terms, etc..
    UpdateRecurringInvoiceRequest:
      type: object
      properties:
        cadence:
          $ref: '#/components/schemas/IntervalCadence'
        invoiceDetails:
          $ref: '#/components/schemas/RecurringInvoiceDetails'
      description: Update a recurring invoice.
    UpdatePaymentRequestRequest:
      required:
        - amount
      type: object
      properties:
        paymentRequestNo:
          type: string
          description: The payment request number.
          example: PR-1234
        description:
          maxLength: 200
          minLength: 0
          type: string
          description: A short description or summary of the payment request.
          example: Monthly subscription fee for January
        payByDate:
          type: string
          description: The pay by date for the payment request.
          format: date-time
          example: '2025-12-15T23:59:59Z'
        amount:
          minimum: 0.01
          exclusiveMinimum: false
          type: number
          description: The payment request amount
          example: 99.99
        reference:
          maxLength: 18
          minLength: 0
          pattern: ^[a-zA-Z0-9 .]*$
          type: string
          description: reference for the payment request
          example: REF 123456
        taxRate:
          maximum: 100
          exclusiveMaximum: false
          minimum: 0
          exclusiveMinimum: false
          type: number
          description: tax rate percentage applied on the payment request amount.
          example: 20
        redirectUrl:
          type: string
          description: >-
            The (optional) redirect URL to redirect the user after they complete
            the payment
      description: Update a payment request.
    AccountDetailsResponse:
      type: object
      properties:
        id:
          type: string
          description: The ID of the account code.
        code:
          type: string
          description: The account code value.
      description: The account details response.
    Address:
      type: object
      properties:
        id:
          type: string
          description: The internal id of the address.
        city:
          type: string
          description: The name of the city.
        postalCode:
          type: string
          description: The postal code.
        country:
          type: string
          description: The name of the biller country.
        addressLine1:
          type: string
          description: The name of the street, and the house or building number.
      description: The address of a biller location
    Cadence:
      required:
        - startDate
        - type
      type: object
      properties:
        type:
          type: string
          description: >-
            The type of cadence.

            * INTERVAL: Interval. Based on a startDate and an (optional) endDate

            * INTERVAL_COUNT: Interval based on a startDate and a count

            * DAY_OF_MONTH: Day of month. Based on a specific day of the month

            * CUSTOM: Custom. Specific list of dates

            . 

            Possible values (non-exclusive): INTERVAL, INTERVAL_COUNT,
            DAY_OF_MONTH, CUSTOM
        timeUnit:
          type: string
          description: >-
            Required if type is INTERVAL.

            Defines the time unit (e.g., DAYS, MONTHS, etc.).

            . 

            Possible values (non-exclusive): SECOND, MINUTE, HOUR, DAY, WEEK,
            MONTH, YEAR
        frequency:
          minimum: 1
          type: integer
          description: |
            Required if type is INTERVAL.
            Frequency of recurrence (e.g., every N time units).
          format: int32
        dayOfMonth:
          type: integer
          description: |
            Required if type is DAY_OF_MONTH.
            Specifies the day of the month the schedule applies.
          format: int32
        dates:
          type: array
          description: |
            Required if type is CUSTOM.
            A list of exact custom dates for the cadence.
          items:
            type: string
            description: |
              Required if type is CUSTOM.
              A list of exact custom dates for the cadence.
            format: date-time
        startDate:
          type: string
          description: The start date of the schedule
          format: date-time
        endDate:
          type: string
          description: The (optional) end date of the schedule
          format: date-time
        count:
          maximum: 120
          minimum: 2
          type: integer
          description: The total number of items. Required for INTERVAL_COUNT type
          format: int32
      description: The cadence of the schedule
    CreditNoteExternalData:
      type: object
      properties:
        connectorType:
          type: string
          description: >-
            The connector type. 

            Possible values (non-exclusive): XERO, QUICKBOOKS, BRIDGE, STRIPE,
            PLATFORM
        id:
          type: string
          description: ID of the Credit Note in the external platform
      description: >-
        References about the credit note from external platforms Adfin
        integrates with.
    CreditNoteResponse:
      type: object
      properties:
        id:
          type: string
          description: Credit note id.
        number:
          type: string
          description: Credit note number.
        amount:
          type: number
          description: Credit note amount.
        valueDate:
          type: string
          description: Date when credit note was applied.
          format: date-time
        externalData:
          type: array
          description: >-
            References about this credit note from external platforms Adfin
            integrates with. Such as ID etc
          items:
            $ref: '#/components/schemas/CreditNoteExternalData'
      description: Credit note details.
    CustomField:
      type: object
      properties:
        fieldId:
          type: string
          description: The ID of the field definition.
        fieldValueId:
          type: string
          description: The ID of the specific field value.
      description: A custom field containing field and field value information.
    CustomerDiscount:
      type: object
      properties:
        percentage:
          type: number
          description: The discount as a percentage to be applied for the invoices.
        period:
          type: integer
          description: The period in hours until the discount expires.
          format: int32
      description: The customer discount details.
    CustomerExternalData:
      required:
        - connectorType
        - id
      type: object
      properties:
        connectorType:
          type: string
          description: |-
            The customer connector type. 
            Possible values (non-exclusive): XERO, QUICKBOOKS
        id:
          type: string
          description: The ID of the Customer in the external platform.
        name:
          type: string
          description: The name of the Customer in the external platform.
      description: >-
        References about the customer from external platforms Adfin integrates
        with.
    CustomerResponse:
      type: object
      properties:
        id:
          type: string
          description: The Adfin id of the customer.
        externalId:
          type: string
          description: >-
            The id of the customer from the platform that is integrating with
            Adfin.
        name:
          type: string
          description: The full name of the customer.
        creationTime:
          type: string
          description: The time the customer was created.
          format: date-time
        lastUpdatedTime:
          type: string
          description: The last time when the customer was updated.
          format: date-time
        people:
          type: array
          description: The list of people assigned to the customer.
          items:
            $ref: '#/components/schemas/Person'
        addresses:
          type: array
          description: The list of the addresses for the customer.
          items:
            $ref: '#/components/schemas/Address'
        directDebitMandate:
          $ref: '#/components/schemas/DirectDebitMandateSummary'
        timezone:
          type: string
          description: The timezone of the customer.
        discount:
          $ref: '#/components/schemas/CustomerDiscount'
        externalData:
          type: array
          description: >-
            References about this customer from external platforms Adfin
            integrates with, such as ID, etc.
          items:
            $ref: '#/components/schemas/CustomerExternalData'
        tags:
          type: array
          description: The tag ids associated with the customer.
          items:
            type: string
            description: The tag ids associated with the customer.
      description: The customer details.
    DirectDebitMandateSummary:
      type: object
      properties:
        id:
          type: string
          description: The id of the direct debit mandate.
        status:
          type: string
          description: >-
            The status of the Direct Debit Mandate, if any present.

            * CREATED: The Direct Debit Mandate was created with success.

            * PENDING: The Direct Debit Mandate was signed and accepted by the
            customer and it is in the Payment Provider's accepted timeframe.

            * ACTIVE: The Direct Debit Mandate was confirmed by the Payment
            Provider.

            * CANCELLED: The Direct Debit Mandate was cancelled directly by the
            customer.

            * MIGRATING: The Direct Debit Mandate is in process of migrating
            from one payment provider to another.. 

            Possible values (non-exclusive): CREATED, PENDING, ACTIVE,
            CANCELLED, MIGRATING
        statusReasonCode:
          type: string
          description: >-
            The reason why the direct debit mandate is in a certain status.

            * PENDING_DD_CAPABILITY - The direct debit mandate was signed, but
            not yet submitted to the payment provider as the biller onboarding
            is still in progress.

            * PENDING_ACTIVATION - The direct debit mandate was signed, but not
            yet activated by the payment provider.

            * MIGRATED - The direct debit mandate was migrated to a new payment
            provider.

            * BANK_ACCOUNT_CHANGED - The direct debit mandate was created due to
            a bank account change (bank switching).

            * INCORRECT_BANK_DETAILS - The direct debit mandate has incorrect
            bank account details.

            * OTHER - Unknown reason. 

            Possible values (non-exclusive): PENDING_DD_CAPABILITY,
            PENDING_ACTIVATION, MIGRATED, BANK_ACCOUNT_CHANGED,
            INCORRECT_BANK_DETAILS, OTHER
        statusReason:
          type: string
          description: >-
            Reason explaining the current status of the direct debit mandate,
            especially useful for failure cases.
        creationTime:
          type: string
          description: The time when the mandate was created
          format: date-time
        lastUpdatedTime:
          type: string
          description: The last time when the mandate was updated
          format: date-time
        authorisationTime:
          type: string
          description: The time when the mandate was signed by the customer
          format: date-time
        submissionTime:
          type: string
          description: The time when the mandate was submitted to the payment provider
          format: date-time
        url:
          type: string
          description: The URL where the customer can sign the direct debit mandate.
      description: Direct Debit details.
    DiscountDetails:
      type: object
      properties:
        totalAmount:
          type: number
          description: The discounted amount
        expirationDate:
          type: string
          description: The date until when the discount is valid
          format: date-time
      description: Information about the discount applied to the payment request
    DistributionDetails:
      type: object
      properties:
        collectionMethod:
          type: string
          description: >-
            How the payment is expected to be collected for this payment
            request.. 

            Possible values (non-exclusive): ONE_TIME_PAYMENT,
            DIRECT_DEBIT_PAYMENT, NONE
        customMessage:
          type: string
          description: >-
            An optional message that will be sent to the customer when the
            payment request is distributed.
        templateId:
          type: string
          description: >-
            The schedule template id used for sending the payment request to
            customer.
      description: Information about how a payment request is distributed and collected.
    InstalmentDetails:
      required:
        - cadence
      type: object
      properties:
        index:
          type: integer
          description: The index of the instalment within the instalment plan (1-based)
          format: int32
        cadence:
          $ref: '#/components/schemas/Cadence'
      description: Instalment details
    InvoiceExternalData:
      type: object
      properties:
        connectorType:
          type: string
          description: >-
            The connector type. 

            Possible values (non-exclusive): XERO, QUICKBOOKS, BRIDGE, STRIPE,
            PLATFORM
        id:
          type: string
          description: ID of the Invoice in the external platform
      description: >-
        References about the invoice from external platforms Adfin integrates
        with.
    LineItemExternalData:
      type: object
      properties:
        id:
          type: string
          description: The ID from the external platform
        connectorType:
          type: string
          description: >-
            The connector type. 

            Possible values (non-exclusive): XERO, QUICKBOOKS, BRIDGE, STRIPE,
            PLATFORM
        templateId:
          type: string
          description: >-
            The template ID from external platform from which this line item is
            created. Cannot use both the template ID and the account code.
        accountCode:
          type: string
          description: >-
            The account code from external platform from which this line item is
            created. Cannot use both the template ID and the account code.
      description: >-
        References about the line items from external platforms Adfin integrates
        with.
    LineItemResponse:
      type: object
      properties:
        id:
          type: string
          description: The ID of the line item to update.
        description:
          type: string
          description: The description of the item.
        quantity:
          type: number
          description: The quantity of items.
        unitAmount:
          type: number
          description: The price per unit of the item.
        taxRate:
          type: number
          description: >-
            The tax rate percentage applied on the line item amount (quantity *
            unit amount).
        taxAmount:
          type: number
          description: The tax amount added on top of the line item amount.
        totalAmount:
          type: number
          description: The total price of the item.
        taxDetails:
          $ref: '#/components/schemas/TaxDetailsResponse'
        accountDetails:
          $ref: '#/components/schemas/AccountDetailsResponse'
        productDetails:
          $ref: '#/components/schemas/ProductDetailsResponse'
        trackingGroupIds:
          type: array
          description: Tracking groups attached to this line item.
          items:
            $ref: '#/components/schemas/TrackingGroupId'
        externalData:
          type: array
          description: Information about this line item captured from external systems
          items:
            $ref: '#/components/schemas/LineItemExternalData'
      description: The line items associated with the invoice.
    PaymentExternalData:
      type: object
      properties:
        connectorType:
          type: string
          description: >-
            The connector type. 

            Possible values (non-exclusive): XERO, QUICKBOOKS, BRIDGE, STRIPE,
            PLATFORM
        id:
          type: string
          description: ID of the payment in the external platform
      description: >-
        References about the credit note from external platforms Adfin
        integrates with.
    PaymentLinkDetails:
      type: object
      properties:
        url:
          type: string
          description: The payment URL.
        lastSeenTime:
          type: string
          description: The date when the payment link was seen for the last time
          format: date-time
      description: Payment link details.
    PaymentRequestResponse:
      type: object
      properties:
        id:
          type: string
          description: The internal id of the payment request
        paymentRequestNo:
          type: string
          description: The payment request number
        reference:
          type: string
          description: The payment request reference
        description:
          type: string
          description: Short description of the payment request
        totalAmount:
          type: number
          description: The payment request amount
        paidAmount:
          type: number
          description: The total amount that is paid
        dueAmount:
          type: number
          description: The amount that is due
        currencyCode:
          type: string
          description: >-
            The default currency of the biller.. 

            Possible values (non-exclusive): AED, AFN, ALL, AMD, ANG, AOA, ARS,
            AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL,
            BSD, BTN, BWP, BYR, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC,
            CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP,
            GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG,
            HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES,
            KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL,
            LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MUR, MVR, MWK, MXN,
            MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP,
            PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK,
            SGD, SHP, SLL, SOS, SPL, SRD, STD, SVC, SYP, SZL, THB, TJS, TMT,
            TND, TOP, TRY, TTD, TVD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF,
            VND, VUV, WST, XAF, XCD, XDR, XOF, XPF, YER, ZAR, ZMW, ZWD
        taxRate:
          type: number
          description: Tax rate percentage
        payByDate:
          type: string
          description: The (optional) date until when user recommended the payer to pay
          format: date-time
        creationTime:
          type: string
          description: The date the payment request was created
          format: date-time
        distributionTime:
          type: string
          description: The time when the payment request was distributed to the customer
          format: date-time
        lastNotificationSentTime:
          type: string
          description: The date the payment request was last sent to the customer
          format: date-time
        lastUpdatedTime:
          type: string
          description: The date the payment request was last updated
          format: date-time
        paidTime:
          type: string
          description: The date the payment request paid
          format: date-time
        paymentInitiationDate:
          type: string
          description: >-
            The date when payment is initiated for this payment request (only
            for Direct Debit)
          format: date-time
        chargeDate:
          type: string
          description: The date on which the customer will have their account debited
          format: date-time
        payoutDate:
          type: string
          description: The date on which the biller will get paid out for the payment
          format: date-time
        status:
          type: string
          description: >-
            The status of the payment request.

            * DRAFT: The payment request does not contain contact details for
            the payer or it is not yet distributed.

            * UNPAID: The payment request is not yet paid.

            * OVERDUE: THe payment request is not yet paid and is past the pay
            by date.

            * SCHEDULED: The payment request is scheduled to collect the payment
            via Direct Debit.

            * SUBMITTED: The remaining due amount on the payment request is
            covered by submitted (but not yet confirmed) Direct debit payments.

            * PAID: The payment request payment is captured.

            * VOID: The payment request is voided.

            * SETTLED: The payment request is paid out.

            . 

            Possible values (non-exclusive): DRAFT, UNPAID, OVERDUE, SCHEDULED,
            SUBMITTED, PAID, VOID, SETTLED
        statusReasonCode:
          type: string
          description: >-
            The reason why the invoice is in a certain status.

            * MISSING_PAYER_CONTACT_DETAILS - The invoice is missing the contact
            details of payer.

            * PENDING_ACTIVATION - The invoice is not yet distributed by
            Adfin.. 

            Possible values (non-exclusive): MISSING_PAYER_CONTACT_DETAILS,
            PENDING_ACTIVATION, PENDING_DD_MANDATE, PENDING_DD_CAPABILITY,
            MARKED_AS_PAID, WORKFLOW_COMPLETED, NOTIFICATION_DELIVERY_FAILED,
            BULK_PRUNE, OTHER
        statusReason:
          type: string
          description: Custom details on why the payment request is in a certain status
        paymentRequestSource:
          type: string
          description: >-
            The source of the payment request. 

            Possible values (non-exclusive): MANUAL, SCHEDULE, INVOICE,
            EXTERNAL, OVERPAYMENT
        payments:
          type: array
          description: The payments made as part of this payment request
          items:
            $ref: '#/components/schemas/PaymentResponse'
        discounts:
          type: array
          description: The discounts applied to this payment request
          items:
            $ref: '#/components/schemas/DiscountDetails'
        paymentLink:
          $ref: '#/components/schemas/PaymentLinkDetails'
        redirectUrl:
          type: string
          description: >-
            The (optional) redirect URL to redirect the user after they complete
            the payment
        invoices:
          type: array
          description: The invoices associated to this payment request
          items:
            $ref: '#/components/schemas/InvoiceDetails'
        customer:
          $ref: '#/components/schemas/CustomerResponse'
        distribution:
          $ref: '#/components/schemas/DistributionDetails'
        associationType:
          type: string
          description: >-
            Payment request association type.

            * SINGLE - a one off payment request.

            * ONE_TO_ONE - a payment request associated with a single invoice.

            * PARTIAL - a payment request that is associated with an invoice
            that has multiple payment requests (many to one)

            * BATCH - a payment request that is associated with multiple
            invoices (one to many). 

            Possible values (non-exclusive): SINGLE, ONE_TO_ONE, PARTIAL, BATCH
        creditControlStatus:
          type: string
          description: |-
            The credit control status of the payment request. 
            Possible values (non-exclusive): AT_RISK, EXPECTED, CONFIRMED
        workflowType:
          type: string
          description: |-
            The workflow type of the payment request. 
            Possible values (non-exclusive): AUTO_COLLECT, ON_DEMAND, NONE
        scheduleDetails:
          $ref: '#/components/schemas/ScheduleDetails'
        instalmentDetails:
          $ref: '#/components/schemas/InstalmentDetails'
        customFields:
          type: array
          description: The list of custom fields that are applied to the payment request
          items:
            $ref: '#/components/schemas/CustomField'
        tags:
          type: array
          description: The list of tag ids that are applied to the payment request
          items:
            type: string
            description: The list of tag ids that are applied to the payment request
        createdBy:
          type: string
          description: The creator of the payment request
      description: Payment Request
    PaymentResponse:
      required:
        - amount
        - channelPaymentId
        - creationTime
        - id
        - paymentMethod
        - paymentRequestId
        - status
      type: object
      properties:
        id:
          type: string
          description: The internal id of the payment
        paymentRequestId:
          type: string
          description: The ID of the payment request
        creationTime:
          type: string
          description: The date when the payment was initiated
          format: date-time
        lastUpdatedTime:
          type: string
          description: The last time when the payment was updated
          format: date-time
        amount:
          type: number
          description: The paid amount
        status:
          type: string
          description: >-
            Statuses for payments. 

            Possible values (non-exclusive): PENDING, SUBMITTED, SENT, SUCCESS,
            CANCELLED, FAILED, SETTLED
        paymentMethod:
          type: string
          description: >-
            Payment method types. 

            Possible values (non-exclusive): BANK_PAYMENT, CARD, APPLE_PAY,
            GOOGLE_PAY, DIRECT_DEBIT, IMPORTED, MANUAL_BANK_TRANSFER,
            BANK_TRANSFER, AMEX
        channelPaymentId:
          type: string
          description: Unique identifier for the payment in the payment provider's system
        channelPaymentUrl:
          type: string
          description: The URL generated by the payment provider to perform the payment
        channelReferenceId:
          type: string
          description: The remittance reference ID for bank payments
        externalData:
          type: array
          description: >-
            References about this payment from external platforms Adfin
            integrates with
          items:
            $ref: '#/components/schemas/PaymentExternalData'
        metadata:
          type: object
      description: Payment response details
    Person:
      type: object
      properties:
        id:
          type: string
          description: The internal id of the person.
        firstName:
          type: string
          description: The first name of the person.
        lastName:
          type: string
          description: The last name of the person.
        email:
          type: string
          description: The email of the person.
        phoneNo:
          type: string
          description: The phone number of the person.
        isPrimaryContact:
          type: boolean
          description: True if this person is a primary contact.
        isIncludedInCommunications:
          type: boolean
          description: True if this person is included in the customers communications.
      description: The data defining a person.
    ProductDetailsResponse:
      type: object
      properties:
        id:
          type: string
          description: The ID of the product.
        code:
          type: string
          description: The product code value.
      description: The product details response.
    ScheduleDetails:
      required:
        - scheduleId
        - scheduleNo
      type: object
      properties:
        scheduleId:
          type: string
          description: The internal id of the schedule
        scheduleNo:
          type: string
          description: The schedule number
        type:
          type: string
          description: |-
            The type of schedule.
            * RECURRING: Recurring Payment Request.
            . 
            Possible values (non-exclusive): RECURRING
      description: The details about the schedule associated with a payment request
    TaxDetailsResponse:
      type: object
      properties:
        id:
          type: string
          description: The ID of the tax rate.
        rate:
          type: number
          description: The actual rate value.
      description: The tax details response.
    TrackingGroupId:
      type: object
      properties:
        groupId:
          type: string
          description: Tracking group id.
        itemId:
          type: string
          description: Tracking group selection option id.
      description: Line item tracking group.
    ActivateInvoiceRequest:
      type: object
      properties:
        collectionMethod:
          type: string
          description: >-
            How the payment is expected to be collected for this invoice.. 

            Possible values (non-exclusive): ONE_TIME_PAYMENT,
            DIRECT_DEBIT_PAYMENT, NONE
        customMessage:
          type: string
          description: >-
            An optional message that will be sent to the customer when the
            invoice is activated.
        templateId:
          type: string
          description: The schedule template id used for sending the invoice to customer.
      description: >-
        Activate an invoice. Sends it to collection via One time payment or
        Direct Debit
    UpdateDistributionDetailsRequest:
      type: object
      properties:
        paymentRequestIds:
          type: array
          description: >-
            The IDs of the payment requests for which to update the distribution
            details
          items:
            type: string
            description: >-
              The IDs of the payment requests for which to update the
              distribution details
        distributionDetails:
          $ref: '#/components/schemas/CollectionDetails'
      description: >-
        Request for updating the distribution details for a list of payment
        requests
    InstalmentPlanDetails:
      required:
        - cadence
      type: object
      properties:
        cadence:
          $ref: '#/components/schemas/Cadence'
      description: Instalment plan details
    UpdateInvoiceRequest:
      type: object
      properties:
        invoiceNo:
          type: string
          description: The unique number of the invoice. Acts as an idempotency key.
          example: INV-12345
        customer:
          $ref: '#/components/schemas/CustomerDetails'
        description:
          type: string
          description: A short description or summary of the invoice.
          example: Monthly subscription fee for January
        dueDate:
          type: string
          description: The due date for the invoice payment.
          format: date-time
          example: '2025-12-15T23:59:59Z'
        issueDate:
          type: string
          description: The date the invoice is issued.
          format: date-time
          example: '2025-12-15T09:00:00Z'
        itemsTaxType:
          type: string
          description: |-
            Specifies how tax is applied to line items in an invoice.
            * EXCLUSIVE: Line items are exclusive of tax.
            * INCLUSIVE: Line items are inclusive tax.
            * NONE: Line items have no tax.. 
            Possible values (non-exclusive): EXCLUSIVE, INCLUSIVE, NONE
        items:
          type: array
          description: The list of items included in this invoice.
          items:
            $ref: '#/components/schemas/UpdateLineItemRequest'
        instalmentPlanDetails:
          $ref: '#/components/schemas/InstalmentPlanDetails'
        paymentRequests:
          type: array
          description: >-
            Details for the invoice's payment requests. Only required for
            invoices with multiple payment requests (ex: instalments).
          items:
            $ref: '#/components/schemas/UpdatePaymentRequestDetails'
      description: Update an invoice.
    UpdateLineItemRequest:
      type: object
      properties:
        id:
          type: string
          description: >-
            The ID of the line item to update. To add a new item, do not include
            ID and it will be returned on succesful PUT request.
        description:
          type: string
          description: The description of the item.
        unitAmount:
          type: number
          description: The price per unit of the item.
        quantity:
          type: number
          description: The quantity of items.
        taxRate:
          type: number
          description: >-
            The tax rate percentage applied on the line item amount (quantity *
            unit amount).
        taxRateId:
          type: string
          description: Tax rate id for this line item.
        accountCodeId:
          type: string
          description: Sales account id for this line item.
        productId:
          type: string
          description: The base product id for this line item.
        trackingGroupIds:
          type: array
          description: Tracking groups attached to this line item.
          items:
            $ref: '#/components/schemas/TrackingGroupId'
        externalData:
          type: array
          description: Information about this line item captured from external systems
          items:
            $ref: '#/components/schemas/LineItemExternalData'
      description: Update a line item.
    UpdatePaymentRequestDetails:
      required:
        - amount
        - payByDate
      type: object
      properties:
        id:
          type: string
          description: >-
            The ID of the payment request to update. Not required for new
            payment requests.
          example: 3d6be112-2825-4ee6-8287-ea9171e20b36
        amount:
          minimum: 0.01
          exclusiveMinimum: false
          type: number
          description: The payment request amount.
          example: 100
        payByDate:
          type: string
          description: The date by which the payment request should be paid
          format: date-time
          example: '2025-03-25T11:36:55.243Z'
      description: Details for the payment request
    InvoiceResponse:
      type: object
      properties:
        id:
          type: string
          description: The internal id of the invoice
        invoiceNo:
          type: string
          description: >
            The number of the invoice. Can be empty when creating the invoice
            without an invoice number,but it will be automatically generated
            when the invoice is pushed to an accounting software. Once set,
            serves as a unique value that can be used as an idempotency key.
        description:
          type: string
          description: Short description of the invoice
        totalAmount:
          type: string
          description: >-
            The invoice total amount. Includes tax amount, amount paid or
            reduced with credit notes)
        taxAmount:
          type: string
          description: The invoice tax amount.
        dueAmount:
          type: string
          description: The invoice amount due (remaining to be paid).
        creditNotesAmount:
          type: string
          description: The total amount that is credited.
        dueDate:
          type: string
          description: The due date of the invoice
          format: date-time
        issueDate:
          type: string
          description: The issue date date of the invoice
          format: date-time
        creationTime:
          type: string
          description: The date the invoice was created
          format: date-time
        lastUpdatedTime:
          type: string
          description: The date the invoice was last updated
          format: date-time
        paidTime:
          type: string
          description: The date the invoice was paid
          format: date-time
        status:
          type: string
          description: >-
            The status of the invoice.

            * DRAFT: The invoice is created, but not yet activated (sent)

            * UNPAID: The invoice is not yet paid.

            * SCHEDULED: The invoice is scheduled to collect the payment via
            Direct Debit.

            * SUBMITTED: The remaining due amount on the invoice is covered by
            submitted (but not yet confirmed) Direct Debit payments.

            * OVERDUE: The invoice is not yet paid and it is passed the due
            date.

            * PAID: The invoice payment has been captured.

            * SETTLED: The invoice is paid out.

            * VOID: The invoice was voided.. 

            Possible values (non-exclusive): DRAFT, UNPAID, OVERDUE, SCHEDULED,
            SUBMITTED, PAID, VOID, SETTLED
        statusReasonCode:
          type: string
          description: >-
            The reason why the invoice is in a certain status.

            * MISSING_PAYER_CONTACT_DETAILS - The invoice is missing the contact
            details of payer.

            * PENDING_ACTIVATION - The invoice is not yet distributed by
            Adfin.. 

            Possible values (non-exclusive): MISSING_PAYER_CONTACT_DETAILS,
            PENDING_ACTIVATION, PENDING_DD_MANDATE, PENDING_DD_CAPABILITY,
            MARKED_AS_PAID, WORKFLOW_COMPLETED, NOTIFICATION_DELIVERY_FAILED,
            BULK_PRUNE, OTHER
        statusReason:
          type: string
          description: Custom details on why the invoice is in a certain status
        invoiceSource:
          type: string
          description: >-
            The source of the invoice. 

            Possible values (non-exclusive): FILE_UPLOAD, MANUAL, PR, EXTERNAL,
            SCHEDULE, PLATFORM
        customer:
          $ref: '#/components/schemas/CustomerResponse'
        itemsTaxType:
          type: string
          description: |-
            Specifies how tax is applied to line items in an invoice.
            * EXCLUSIVE: Line items are exclusive of tax.
            * INCLUSIVE: Line items are inclusive tax.
            * NONE: Line items have no tax.. 
            Possible values (non-exclusive): EXCLUSIVE, INCLUSIVE, NONE
        instalmentPlanDetails:
          $ref: '#/components/schemas/InstalmentPlanDetails'
        items:
          type: array
          description: The list of items from the invoice
          items:
            $ref: '#/components/schemas/LineItemResponse'
        paymentRequests:
          type: array
          description: The payment requests that were created for this invoice
          items:
            $ref: '#/components/schemas/PaymentRequestDetails'
        scheduleDetails:
          $ref: '#/components/schemas/ScheduleDetails'
        creditNotes:
          type: array
          description: The list of credit notes from the invoice
          items:
            $ref: '#/components/schemas/CreditNoteResponse'
        fileSource:
          type: string
          description: >-
            The file source of invoice. 

            Possible values (non-exclusive): NONE, FILE_UPLOAD, EXTERNAL, ADFIN,
            PENDING_ADFIN
        externalData:
          type: array
          description: >-
            References about this invoice from external platforms Adfin
            integrates with. Such as ID etc
          items:
            $ref: '#/components/schemas/InvoiceExternalData'
        creditControlStatus:
          type: string
          description: |-
            The credit control status of the invoice. 
            Possible values (non-exclusive): AT_RISK, EXPECTED, CONFIRMED
        workflowType:
          type: string
          description: |-
            The workflow type of the invoice. 
            Possible values (non-exclusive): AUTO_COLLECT, ON_DEMAND, NONE
        customFields:
          type: array
          description: The list of custom fields that are applied to the invoice
          items:
            $ref: '#/components/schemas/CustomField'
      description: Invoice response object.
    PaymentRequestDetails:
      type: object
      properties:
        id:
          type: string
          description: The internal id of the payment request
        paymentRequestNo:
          type: string
          description: The payment request number
        description:
          type: string
          description: Short description of the payment request
        totalAmount:
          type: number
          description: The payment request amount
        paidAmount:
          type: number
          description: The total amount that is paid
        currencyCode:
          type: string
          description: >-
            The default currency of the biller.. 

            Possible values (non-exclusive): AED, AFN, ALL, AMD, ANG, AOA, ARS,
            AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL,
            BSD, BTN, BWP, BYR, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC,
            CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP,
            GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG,
            HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES,
            KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL,
            LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MUR, MVR, MWK, MXN,
            MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP,
            PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK,
            SGD, SHP, SLL, SOS, SPL, SRD, STD, SVC, SYP, SZL, THB, TJS, TMT,
            TND, TOP, TRY, TTD, TVD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF,
            VND, VUV, WST, XAF, XCD, XDR, XOF, XPF, YER, ZAR, ZMW, ZWD
        payByDate:
          type: string
          description: The (optional) date until when user recommended the payer to pay
          format: date-time
        creationTime:
          type: string
          description: The date the payment request was created
          format: date-time
        lastNotificationSentTime:
          type: string
          description: The date the payment request was last sent to the customer
          format: date-time
        lastUpdatedTime:
          type: string
          description: The date the payment request was last updated
          format: date-time
        paidTime:
          type: string
          description: The date the payment request paid
          format: date-time
        paymentInitiationDate:
          type: string
          description: >-
            The date when payment is initiated for this payment request (only
            for Direct Debit)
          format: date-time
        chargeDate:
          type: string
          description: The date on which the customer will have their account debited
          format: date-time
        payoutDate:
          type: string
          description: The date on which the biller will get paid out for the payment
          format: date-time
        distributionTime:
          type: string
          description: The date when the payment request was distributed
          format: date-time
        status:
          type: string
          description: >-
            The status of the payment request.

            * DRAFT: The payment request does not contain contact details for
            the payer or it is not yet distributed.

            * UNPAID: The payment request is not yet paid.

            * OVERDUE: THe payment request is not yet paid and is past the pay
            by date.

            * SCHEDULED: The payment request is scheduled to collect the payment
            via Direct Debit.

            * SUBMITTED: The remaining due amount on the payment request is
            covered by submitted (but not yet confirmed) Direct debit payments.

            * PAID: The payment request payment is captured.

            * VOID: The payment request is voided.

            * SETTLED: The payment request is paid out.

            . 

            Possible values (non-exclusive): DRAFT, UNPAID, OVERDUE, SCHEDULED,
            SUBMITTED, PAID, VOID, SETTLED
        statusReasonCode:
          type: string
          description: >-
            The reason why the invoice is in a certain status.

            * MISSING_PAYER_CONTACT_DETAILS - The invoice is missing the contact
            details of payer.

            * PENDING_ACTIVATION - The invoice is not yet distributed by
            Adfin.. 

            Possible values (non-exclusive): MISSING_PAYER_CONTACT_DETAILS,
            PENDING_ACTIVATION, PENDING_DD_MANDATE, PENDING_DD_CAPABILITY,
            MARKED_AS_PAID, WORKFLOW_COMPLETED, NOTIFICATION_DELIVERY_FAILED,
            BULK_PRUNE, OTHER
        statusReason:
          type: string
          description: Custom details on why the payment request is in a certain status
        reference:
          type: string
          description: The payment request reference
        payments:
          type: array
          description: The payments made as part of this payment request
          items:
            $ref: '#/components/schemas/PaymentResponse'
        discounts:
          type: array
          description: The discounts applied to this payment request
          items:
            $ref: '#/components/schemas/DiscountDetails'
        paymentLink:
          $ref: '#/components/schemas/PaymentLinkDetails'
        distribution:
          $ref: '#/components/schemas/DistributionDetails'
        workflowType:
          type: string
          description: |-
            The workflow type of the payment request. 
            Possible values (non-exclusive): AUTO_COLLECT, ON_DEMAND, NONE
        customFields:
          type: array
          description: The list of custom fields that are applied to the payment request
          items:
            $ref: '#/components/schemas/CustomField'
      description: Payment Request details.
    VoidInvoiceRequest:
      type: object
      properties:
        reasonCode:
          type: string
        reason:
          type: string
    UpdateCustomerRequest:
      type: object
      properties:
        id:
          type: string
          description: The Adfin id of the customer.
        externalId:
          type: string
          description: >-
            The id of the customer from the platform that is integrating with
            Adfin.
        name:
          type: string
          description: The full name of the customer.
        people:
          type: array
          description: The list of people assigned to the customer.
          items:
            $ref: '#/components/schemas/Person'
        addresses:
          type: array
          description: >-
            The list of the addresses for the customer. Only 1 pe supported for
            now
          items:
            $ref: '#/components/schemas/Address'
        externalData:
          $ref: '#/components/schemas/CustomerExternalData'
      description: Details to update a customer.
    DirectDebitMandateResponse:
      type: object
      properties:
        id:
          type: string
          description: The ID of the mandate
        creationTime:
          type: string
          description: The creation time of the mandate
          format: date-time
        lastUpdateTime:
          type: string
          description: The last time when the mandate was updated
          format: date-time
        distributionTime:
          type: string
          description: The time when the mandate was sent to the customer
          format: date-time
        authorisationTime:
          type: string
          description: The time when the mandate was signed by the customer
          format: date-time
        submissionTime:
          type: string
          description: The time when the mandate was submitted to the payment provider
          format: date-time
        status:
          type: string
          description: >-
            The mandate status. 

            Possible values (non-exclusive): CREATED, PENDING, ACTIVE,
            CANCELLED, MIGRATING
        failureReason:
          type: string
          description: The reason for failing to set up the mandate
        statusReasonCode:
          type: string
          description: >-
            The reason why the direct debit mandate is in a certain status.

            * PENDING_DD_CAPABILITY - The direct debit mandate was signed, but
            not yet submitted to the payment provider as the biller onboarding
            is still in progress.

            * PENDING_ACTIVATION - The direct debit mandate was signed, but not
            yet activated by the payment provider.

            * MIGRATED - The direct debit mandate was migrated to a new payment
            provider.

            * BANK_ACCOUNT_CHANGED - The direct debit mandate was created due to
            a bank account change (bank switching).

            * INCORRECT_BANK_DETAILS - The direct debit mandate has incorrect
            bank account details.

            * OTHER - Unknown reason. 

            Possible values (non-exclusive): PENDING_DD_CAPABILITY,
            PENDING_ACTIVATION, MIGRATED, BANK_ACCOUNT_CHANGED,
            INCORRECT_BANK_DETAILS, OTHER
        statusReason:
          type: string
          description: >-
            Reason explaining the current status of the direct debit mandate,
            especially useful for failure cases.
        customer:
          $ref: '#/components/schemas/CustomerResponse'
        url:
          type: string
          description: The URL where the customer can sign the direct debit mandate.
        redirectUrl:
          type: string
          description: >-
            The (optional) redirect URL to redirect the user after they sign the
            mandate
        sender:
          $ref: '#/components/schemas/SenderResponse'
        bankAccountNumber:
          type: string
          description: The mandate bank account number
        sortCode:
          type: string
          description: The mandate sort code
        bankAccountHolderName:
          type: string
          description: The mandate bank account holder name
      description: Direct Debit mandate details
    SenderResponse:
      type: object
      properties:
        name:
          type: string
          description: The registration name of the sender.
      description: The sender details.
    AutoCollectSettings:
      required:
        - isDefault
        - isEnabled
      type: object
      properties:
        isEnabled:
          type: boolean
          description: Indicates whether auto-collect workflow is enabled
        isDefault:
          type: boolean
          description: Indicates whether auto-collect is the default workflow
        pauseCollection:
          type: boolean
          description: >
            When `true`, payment collection is paused.

            While paused, no automatic retries or scheduled collection attempts
            will occur.
          example: true
        resumeCollectionAt:
          type: string
          description: |
            The timestamp when automatic collection should resume.
            If `null`, collection remains paused until updated manually.
          format: date-time
          example: '2025-01-15T10:00:00Z'
      description: Auto-collect workflow settings
    CustomerWorkflowSettings:
      required:
        - autoCollect
        - customerStatement
        - onDemand
      type: object
      properties:
        autoCollect:
          $ref: '#/components/schemas/AutoCollectSettings'
        onDemand:
          $ref: '#/components/schemas/OnDemandSettings'
        customerStatement:
          $ref: '#/components/schemas/CustomerStatementSettings'
      description: Customer workflow settings
    OnDemandSettings:
      required:
        - isDefault
        - isEnabled
      type: object
      properties:
        isEnabled:
          type: boolean
          description: Indicates whether on-demand workflow is enabled
        isDefault:
          type: boolean
          description: Indicates whether on-demand is the default workflow
      description: On-demand workflow settings
    UpsertCustomerWorkflowSettingsRequest:
      required:
        - customerIds
        - workflowSettings
      type: object
      properties:
        customerIds:
          type: array
          description: List of customer IDs to update
          items:
            type: string
            description: List of customer IDs to update
        workflowSettings:
          $ref: '#/components/schemas/CustomerWorkflowSettings'
      description: Request for upserting customer workflow settings
    CustomerWorkflowSettingsResponse:
      required:
        - autoCollect
        - customerStatement
        - onDemand
      type: object
      properties:
        autoCollect:
          $ref: '#/components/schemas/AutoCollectSettings'
        onDemand:
          $ref: '#/components/schemas/OnDemandSettings'
        customerStatement:
          $ref: '#/components/schemas/CustomerStatementSettings'
      description: Customer workflow settings
    CancelDirectDebitMandateRequest:
      type: object
      properties:
        reason:
          type: string
          description: The reason for cancelling a direct debit mandate
    UpdateWebhookRequest:
      type: object
      properties:
        url:
          type: string
          description: The url of the webhook target.
          example: https://hooks.example.com/adfin/webhooks
        events:
          type: array
          description: The list of events to subscribe.
          example:
            - invoice
            - dd-mandate
          items:
            type: string
            description: >-
              The supported event types for webhooks subscription. 

              Possible values (non-exclusive): payment, dd-mandate, invoice,
              biller, customer, payment-request
            example: '["invoice","dd-mandate"]'
        name:
          type: string
          description: The name of the webhook.
          example: Adfin Events
        description:
          type: string
          description: The description of the webhook.
          example: Triggers for invoice lifecycle events.
        enabled:
          type: boolean
          description: The state of the webhook configuration.
    WebhookResponse:
      type: object
      properties:
        id:
          type: string
          description: The identifier of the webhook
        clientId:
          type: string
          description: The identifier of the application
        url:
          type: string
          description: The target URL of the webhook
        name:
          type: string
          description: Name of the webhook
        description:
          type: string
          description: Description of the webhook
        events:
          type: array
          description: The list of event types to trigger webhook instantiation
          items:
            type: string
            description: The list of event types to trigger webhook instantiation
        enabled:
          type: boolean
          description: The state of the webhook
        creationTime:
          type: string
          description: The creation timestamp of the webhook
          format: date-time
        lastUpdatedTime:
          type: string
          description: The last updated timestamp of the webhook
          format: date-time
    WebhookDigestResponse:
      type: object
      properties:
        secretKey:
          type: string
    ApiKeyAuthentication:
      type: object
      properties:
        headerKey:
          type: string
          description: The header key of the API Key used by the webhook invocations
        headerValue:
          type: string
          description: The header value of the API Key used by the webhook invocations
      description: API Key used for the webhook invocations authentication.
    BasicAuthentication:
      type: object
      properties:
        username:
          type: string
          description: >-
            The username used by the webhook invocations for basic
            authentication
        password:
          type: string
          description: >-
            The password used by the webhook invocations for basic
            authentication
      description: Basic authentication credentials used for the webhook invocations.
    WebhookAuthenticationRequest:
      type: object
      properties:
        basicAuthentication:
          $ref: '#/components/schemas/BasicAuthentication'
        apiKeyAuthentication:
          $ref: '#/components/schemas/ApiKeyAuthentication'
    CreateRecurringPaymentRequestRequest:
      required:
        - cadence
        - paymentRequestDetails
      type: object
      properties:
        cadence:
          $ref: '#/components/schemas/IntervalCadence'
        paymentRequestDetails:
          $ref: '#/components/schemas/RecurringPaymentRequestDetails'
      description: >
        This endpoint defines how payment request are generated on a recurring
        basis.

        The `cadence` field controls when new payment request are created,

        while `paymentRequestDetails` defines what those payment request
        contain.
      example:
        cadence:
          type: INTERVAL
          timeUnit: MONTHS
          frequency: 1
          startDate: '2025-01-01T00:00:00Z'
        paymentRequestDetails:
          customer:
            id: 80349480-490b-4234-92e7-fad697e3d446
          paymentTerm:
            timeUnit: DAYS
            value: 30
          distribution:
            collectionMethod: AUTO_COLLECT
            templateId: d290f1ee-6c54-4b01-90e6-d701748f0851
            customMessage: Thank you for your business!
            approvedForSending: true
          amount: '10.00'
          taxRate: '0.1'
          currencyCode: GBP
          description: Monthly subscription for January
          reference: PR-01
    CreateRecurringInvoiceRequest:
      required:
        - cadence
        - invoiceDetails
      type: object
      properties:
        cadence:
          $ref: '#/components/schemas/IntervalCadence'
        invoiceDetails:
          $ref: '#/components/schemas/RecurringInvoiceDetails'
      description: |
        This endpoint defines how invoices are generated on a recurring basis.
        The `cadence` field controls when new invoices are created,
        while `invoiceDetails` defines what those invoices contain.
      example:
        cadence:
          type: INTERVAL
          timeUnit: MONTHS
          frequency: 1
          startDate: '2025-01-01T00:00:00Z'
        invoiceDetails:
          customer:
            id: 80349480-490b-4234-92e7-fad697e3d446
          paymentTerm:
            timeUnit: DAYS
            value: 30
          distribution:
            collectionMethod: AUTO_COLLECT
            templateId: d290f1ee-6c54-4b01-90e6-d701748f0851
            customMessage: Please find your invoice attached. Thank you for your business!
            approvedForSending: true
          description: Monthly subscription for January
          currencyCode: GBP
          itemsTaxType: INCLUSIVE
          items:
            - description: Pro Plan Subscription
              unitAmount: 5000
              quantity: 1
    ImportPaymentRequest:
      required:
        - amount
        - invoiceId
        - reference
      type: object
      properties:
        invoiceId:
          type: string
          description: ID of the invoice to apply payment to
          example: 123e4567-e89b-12d3-a456-426614174000
        amount:
          type: number
          description: Payment amount
          example: 100.5
        reference:
          type: string
          description: Unique payment reference identifier for tracking
          example: REF-20250104
    ImportPaymentResponse:
      type: object
      properties:
        payments:
          type: array
          description: The list of payments created as a result of the import
          items:
            $ref: '#/components/schemas/PaymentResponse'
      description: Import payment response details
    CreatePaymentRequestRequest:
      required:
        - currencyCode
        - customer
        - description
        - totalAmount
      type: object
      properties:
        customer:
          $ref: '#/components/schemas/CustomerDetails'
        description:
          maxLength: 200
          minLength: 0
          type: string
          description: A short description or summary of the payment request.
          example: Monthly subscription fee for January
        totalAmount:
          minimum: 0.01
          exclusiveMinimum: false
          type: number
          description: The payment request amount.
          example: 100
        currencyCode:
          type: string
          description: >-
            The default currency of the biller.. 

            Possible values (non-exclusive): AED, AFN, ALL, AMD, ANG, AOA, ARS,
            AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL,
            BSD, BTN, BWP, BYR, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC,
            CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP,
            GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG,
            HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES,
            KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL,
            LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MUR, MVR, MWK, MXN,
            MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP,
            PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK,
            SGD, SHP, SLL, SOS, SPL, SRD, STD, SVC, SYP, SZL, THB, TJS, TMT,
            TND, TOP, TRY, TTD, TVD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF,
            VND, VUV, WST, XAF, XCD, XDR, XOF, XPF, YER, ZAR, ZMW, ZWD
          example: GBP
        taxRate:
          maximum: 100
          exclusiveMaximum: false
          minimum: 0
          exclusiveMinimum: false
          type: number
          description: Optional tax rate percentage applied on the payment request amount.
          example: 20
        reference:
          maxLength: 18
          minLength: 0
          pattern: ^[a-zA-Z0-9 .]*$
          type: string
          description: Optional reference for the payment request.
          example: REF 123456
        payByDate:
          type: string
          description: The date by which the payment request should be paid
          format: date-time
          example: '2025-03-25T11:36:55.243Z'
        distribution:
          $ref: '#/components/schemas/DistributionDetails'
        redirectUrl:
          type: string
          description: >-
            The (optional) redirect URL to redirect the user after they complete
            the payment
      description: Create a payment request
    BulkPaymentRequestImportResponse:
      required:
        - countsByItemStatus
        - creationTime
        - jobId
        - status
        - type
      type: object
      properties:
        jobId:
          type: string
          description: The internal id of the bulk import job
        type:
          type: string
          description: |-
            The type of the import job. 
            Possible values (non-exclusive): BULK_PAYMENT_REQUEST_IMPORT
        status:
          type: string
          description: >-
            The status of the import job. 

            Possible values (non-exclusive): PENDING, PROCESSING, COMPLETED,
            FAILED, DELETED
        creationTime:
          type: string
          description: The creation time of the import job
          format: date-time
        countsByItemStatus:
          type: array
          description: The count of items for each review session item status
          items:
            $ref: '#/components/schemas/ReviewSessionItemCountByStatus'
      description: Bulk payment request import response
    ReviewSessionItemCountByStatus:
      required:
        - count
        - status
      type: object
      properties:
        status:
          type: string
          description: >-
            The status of review session item. 

            Possible values (non-exclusive): PENDING, PROCESSING, COMPLETED,
            FAILED
        count:
          type: integer
          description: The count of items for this status
          format: int32
      description: The count of items for each review session item status
    AuthorizeRequest:
      type: object
      properties:
        clientId:
          type: string
        refreshToken:
          type: string
        redirectUri:
          type: string
        scopes:
          type: string
        state:
          type: string
    CreateInvoiceRequest:
      type: object
      properties:
        invoiceNo:
          type: string
          description: >-
            The unique number of the invoice. Acts as an idempotency key. Will
            be generated if not provided.
          example: INV-12345
        customer:
          $ref: '#/components/schemas/CustomerDetails'
        description:
          type: string
          description: A short description or summary of the invoice.
          example: Monthly subscription fee for January
        amount:
          type: number
          description: The invoice amount.
        dueDate:
          type: string
          description: The due date for the invoice payment.
          format: date-time
          example: '2025-12-15T23:59:59Z'
        issueDate:
          type: string
          description: The date the invoice is issued.
          format: date-time
          example: '2025-12-15T23:59:59Z'
        itemsTaxType:
          type: string
          description: |-
            Specifies how tax is applied to line items in an invoice.
            * EXCLUSIVE: Line items are exclusive of tax.
            * INCLUSIVE: Line items are inclusive tax.
            * NONE: Line items have no tax.. 
            Possible values (non-exclusive): EXCLUSIVE, INCLUSIVE, NONE
        instalmentPlanDetails:
          $ref: '#/components/schemas/InstalmentPlanDetails'
        items:
          type: array
          description: The list of items included in this invoice.
          items:
            $ref: '#/components/schemas/NewLineItemRequest'
        paymentRequests:
          type: array
          description: >-
            Details for the invoice's payment requests. Only required for
            invoices with multiple payment requests (ex: instalments).
          items:
            $ref: '#/components/schemas/CreatePaymentRequestDetails'
      description: Create an invoice.
    CreatePaymentRequestDetails:
      required:
        - amount
        - payByDate
      type: object
      properties:
        amount:
          minimum: 0.01
          exclusiveMinimum: false
          type: number
          description: The payment request amount.
          example: 100
        payByDate:
          type: string
          description: The date by which the payment request should be paid
          format: date-time
          example: '2025-03-25T11:36:55.243Z'
      description: Details for the payment request
    CreateCustomerRequest:
      type: object
      properties:
        name:
          type: string
          description: The full name of the customer.
          example: John Doe
        people:
          type: array
          description: >-
            A list of people associated with the customer. Can include contacts,
            representatives, or stakeholders.
          example:
            - name: Jane Smith
              email: jane.smith@example.com
          items:
            $ref: '#/components/schemas/Person'
        addresses:
          type: array
          description: >-
            A list of addresses for the customer. Currently, only one address is
            supported.
          example:
            - line1: 2 Catherine Pl
              city: London
              state: NY
              postCode: SW1E 6HF
          items:
            $ref: '#/components/schemas/Address'
        externalData:
          $ref: '#/components/schemas/CustomerExternalData'
      description: Details to create a customer.
    CreateWebhookRequest:
      type: object
      properties:
        url:
          type: string
          description: The url of the webhook target.
          example: https://hooks.example.com/adfin/webhooks
        events:
          type: array
          description: The list of events to subscribe.
          example:
            - invoice
            - dd-mandate
          items:
            type: string
            description: >-
              The supported event types for webhooks subscription. 

              Possible values (non-exclusive): payment, dd-mandate, invoice,
              biller, customer, payment-request
            example: '["invoice","dd-mandate"]'
        name:
          type: string
          description: The name of the webhook.
          example: Adfin Events
        description:
          type: string
          description: The description of the webhook.
          example: Triggers for invoice lifecycle events.
    AddOperation:
      type: object
      allOf:
        - $ref: '#/components/schemas/JsonPatchOperation'
        - type: object
          properties:
            path:
              $ref: '#/components/schemas/JsonPointer'
            value:
              $ref: '#/components/schemas/JsonNode'
    CopyOperation:
      type: object
      allOf:
        - $ref: '#/components/schemas/JsonPatchOperation'
        - type: object
          properties:
            from:
              $ref: '#/components/schemas/JsonPointer'
            path:
              $ref: '#/components/schemas/JsonPointer'
    JsonNode:
      type: object
    JsonPatchOperation:
      required:
        - op
      type: object
      properties:
        op:
          type: string
      description: Patch operations to be applied to biller
      discriminator:
        propertyName: op
    JsonPointer:
      type: object
      properties:
        empty:
          type: boolean
    MoveOperation:
      type: object
      allOf:
        - $ref: '#/components/schemas/JsonPatchOperation'
        - type: object
          properties:
            from:
              $ref: '#/components/schemas/JsonPointer'
            path:
              $ref: '#/components/schemas/JsonPointer'
    PatchBillerRequest:
      type: object
      properties:
        operations:
          type: array
          description: Patch operations to be applied to biller
          items:
            oneOf:
              - $ref: '#/components/schemas/AddOperation'
              - $ref: '#/components/schemas/CopyOperation'
              - $ref: '#/components/schemas/MoveOperation'
              - $ref: '#/components/schemas/RemoveOperation'
              - $ref: '#/components/schemas/ReplaceOperation'
              - $ref: '#/components/schemas/TestOperation'
    RemoveOperation:
      type: object
      allOf:
        - $ref: '#/components/schemas/JsonPatchOperation'
        - type: object
          properties:
            path:
              $ref: '#/components/schemas/JsonPointer'
    ReplaceOperation:
      type: object
      allOf:
        - $ref: '#/components/schemas/JsonPatchOperation'
        - type: object
          properties:
            path:
              $ref: '#/components/schemas/JsonPointer'
            value:
              $ref: '#/components/schemas/JsonNode'
    TestOperation:
      type: object
      allOf:
        - $ref: '#/components/schemas/JsonPatchOperation'
        - type: object
          properties:
            path:
              $ref: '#/components/schemas/JsonPointer'
            value:
              $ref: '#/components/schemas/JsonNode'
    Pagination:
      type: object
      properties:
        page:
          type: integer
          description: The current page number One-based page index (1..N).
          format: int32
        size:
          type: integer
          description: The size of the page, i.e., the number of elements per page.
          format: int32
        totalPages:
          type: integer
          description: The total number of pages available.
          format: int32
        totalElements:
          type: integer
          description: The total number of elements across all pages.
          format: int64
        numberOfElements:
          type: integer
          description: The number of elements in the current page.
          format: int64
        sort:
          type: string
          description: 'Sorting criteria in the format: property,(asc|desc).'
      description: Contains pagination information for a set of results
    PaymentRequestStatusCount:
      type: object
      properties:
        status:
          type: string
          description: >-
            The status of the payment request.

            * DRAFT: The payment request does not contain contact details for
            the payer or it is not yet distributed.

            * UNPAID: The payment request is not yet paid.

            * OVERDUE: THe payment request is not yet paid and is past the pay
            by date.

            * SCHEDULED: The payment request is scheduled to collect the payment
            via Direct Debit.

            * SUBMITTED: The remaining due amount on the payment request is
            covered by submitted (but not yet confirmed) Direct debit payments.

            * PAID: The payment request payment is captured.

            * VOID: The payment request is voided.

            * SETTLED: The payment request is paid out.

            . 

            Possible values (non-exclusive): DRAFT, UNPAID, OVERDUE, SCHEDULED,
            SUBMITTED, PAID, VOID, SETTLED
        count:
          type: integer
          format: int64
    PaymentRequestStatusCountResponse:
      type: object
      properties:
        total:
          type: integer
          format: int64
        statusCounts:
          type: array
          items:
            $ref: '#/components/schemas/PaymentRequestStatusCount'
      description: Payment request count details
    PaymentRequestsResponse:
      type: object
      properties:
        paymentRequests:
          type: array
          description: List of payment requests
          items:
            $ref: '#/components/schemas/PaymentRequestResponse'
        count:
          $ref: '#/components/schemas/PaymentRequestStatusCountResponse'
        pagination:
          $ref: '#/components/schemas/Pagination'
      description: Wrapper for a list of payment requests
    BulkPaymentRequestImportItemResponse:
      required:
        - bulkPrImportOperation
        - creationTime
        - id
        - jobId
        - paymentRequestNo
        - status
        - statusReason
      type: object
      properties:
        id:
          type: string
          description: The ID of the import job item
          format: uuid
        jobId:
          type: string
          description: The ID of the import job
          format: uuid
        paymentRequestNo:
          type: string
          description: The payment request number
        bulkPrImportOperation:
          type: string
          description: |-
            The operation to perform on the import job item. 
            Possible values (non-exclusive): UPSERT, DELETE
        status:
          type: string
          description: >-
            The status of the import job item. 

            Possible values (non-exclusive): PENDING, PROCESSING, COMPLETED,
            FAILED
        statusReason:
          type: string
          description: The reason behind the item's current status
        creationTime:
          type: string
          description: The creation time of import job item
          format: date-time
      description: A bulk payment request import job item
    BulkPaymentRequestImportItemsResponse:
      type: object
      properties:
        items:
          type: array
          description: The bulk payment request import job items for the current page
          items:
            $ref: '#/components/schemas/BulkPaymentRequestImportItemResponse'
        pagination:
          $ref: '#/components/schemas/Pagination'
      description: Paginated bulk payment request import job items
    AppResponse:
      type: object
      properties:
        name:
          type: string
        redirectUri:
          type: array
          items:
            type: string
        scopes:
          type: array
          items:
            type: string
        logoFilePath:
          type: string
    StreamingResponseBody:
      type: object
    CustomersResponse:
      type: object
      properties:
        customers:
          type: array
          description: The list of customers for the specified filter.
          items:
            $ref: '#/components/schemas/CustomerResponse'
        page:
          $ref: '#/components/schemas/Pagination'
        pagination:
          $ref: '#/components/schemas/Pagination'
      description: The list of customers for the specified filter.
    DirectDebitMandatesResponse:
      type: object
      properties:
        mandates:
          type: array
          description: The list of all direct debit mandates for the specified filter.
          items:
            $ref: '#/components/schemas/DirectDebitMandateResponse'
      description: The list of direct debit mandates for the specified filter.
    GetTaxRateCatalogueResponse:
      type: object
      properties:
        items:
          type: array
          description: The list of tax rates
          items:
            $ref: '#/components/schemas/TaxRateCatalogueResponse'
    TaxRateCatalogueResponse:
      type: object
      properties:
        id:
          type: string
          description: The id of the tax rate catalogue entry
          format: uuid
        name:
          type: string
          description: The name of the tax rate catalogue entry
        taxRate:
          type: number
          description: The tax rate. Must be a positive value in the [0,1] interval
        isDefault:
          type: boolean
          description: >-
            Boolean flag specifying if the entry is the default tax rate to be
            used for new line items.
        creationTime:
          type: string
          description: Creation time of the entry
          format: date-time
      description: The list of tax rates
    CatalogueExternalDataRequest:
      type: object
      properties:
        connectorType:
          type: string
          description: >-
            The connector type. 

            Possible values (non-exclusive): XERO, QUICKBOOKS, BRIDGE, STRIPE,
            PLATFORM
        externalId:
          type: string
          description: The unique id of the item in the external platform.
      description: The external data of the line item.
    GetLineItemCatalogueResponse:
      type: object
      properties:
        items:
          type: array
          description: The list of line items catalogue
          items:
            $ref: '#/components/schemas/LineItemCatalogueResponse'
    LineItemCatalogueResponse:
      type: object
      properties:
        id:
          type: string
          description: The id of the item
          format: uuid
        code:
          type: string
          description: The code of the line item
        description:
          type: string
          description: The name of the line item
        unitAmount:
          type: number
          description: The line item price per unit
        taxDetails:
          $ref: '#/components/schemas/TaxDetailsResponse'
        accountDetails:
          $ref: '#/components/schemas/AccountDetailsResponse'
        trackingGroupIds:
          type: array
          description: Tracking groups attached to this line item.
          items:
            $ref: '#/components/schemas/TrackingGroupId'
        externalData:
          type: array
          description: The external data of the line item.
          items:
            $ref: '#/components/schemas/CatalogueExternalDataRequest'
        creationTime:
          type: string
          description: Creation time of element
          format: date-time
      description: The list of line items catalogue
    AccountingConnectorResponse:
      type: object
      properties:
        type:
          type: string
          description: >-
            The connector type. 

            Possible values (non-exclusive): XERO, QUICKBOOKS, BRIDGE, STRIPE,
            PLATFORM
        status:
          type: string
          description: |-
            The status of the accounting connector. 
            Possible values (non-exclusive): CONNECTED, NOT_CONNECTED, PENDING
        externalCode:
          type: string
          description: The unique public facing identifier of the organisation
        collectionMethodSettings:
          $ref: '#/components/schemas/CollectionMethodSettings'
        actionHints:
          $ref: '#/components/schemas/ActionHints'
      description: The list of available accounting connectors
    AccountingSettingsResponse:
      type: object
      properties:
        connectors:
          type: array
          description: The list of available accounting connectors
          items:
            $ref: '#/components/schemas/AccountingConnectorResponse'
      description: The accounting settings of the biller.
    ActionHints:
      type: object
      properties:
        reconnectRequired:
          type: boolean
          description: Whether the user must re-auth/reconnect the accounting connector.
      description: User-facing prompts for follow-up actions
    AmountLimitResponse:
      required:
        - max
        - min
      type: object
      properties:
        min:
          type: string
          description: The min amount limit
        max:
          type: string
          description: The max amount limit
        currencyCode:
          type: string
          description: >-
            The default currency of the biller.. 

            Possible values (non-exclusive): AED, AFN, ALL, AMD, ANG, AOA, ARS,
            AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL,
            BSD, BTN, BWP, BYR, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC,
            CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP,
            GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG,
            HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES,
            KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL,
            LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MUR, MVR, MWK, MXN,
            MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP,
            PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK,
            SGD, SHP, SLL, SOS, SPL, SRD, STD, SVC, SYP, SZL, THB, TJS, TMT,
            TND, TOP, TRY, TTD, TVD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF,
            VND, VUV, WST, XAF, XCD, XDR, XOF, XPF, YER, ZAR, ZMW, ZWD
      description: The amount limits
    BankAccountResponse:
      required:
        - billerId
        - countryCode
        - currencyCode
        - id
        - name
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the bank account.
        billerId:
          type: string
          description: The unique identifier of the biller.
        name:
          maxLength: 255
          minLength: 0
          type: string
          description: The name of the bank account.
        paymentDetails:
          $ref: '#/components/schemas/PaymentDetails'
        currencyCode:
          type: string
          description: >-
            The default currency of the biller.. 

            Possible values (non-exclusive): AED, AFN, ALL, AMD, ANG, AOA, ARS,
            AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL,
            BSD, BTN, BWP, BYR, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC,
            CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP,
            GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG,
            HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES,
            KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL,
            LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MUR, MVR, MWK, MXN,
            MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP,
            PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK,
            SGD, SHP, SLL, SOS, SPL, SRD, STD, SVC, SYP, SZL, THB, TJS, TMT,
            TND, TOP, TRY, TTD, TVD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF,
            VND, VUV, WST, XAF, XCD, XDR, XOF, XPF, YER, ZAR, ZMW, ZWD
        countryCode:
          type: string
          description: The default country code of the bank account.
      description: The bank accounts of the biller.
    BillerExternalData:
      required:
        - connectorType
        - id
      type: object
      properties:
        connectorType:
          type: string
          description: |-
            The biller connector type. 
            Possible values (non-exclusive): XERO, QUICKBOOKS
        id:
          type: string
          description: The ID of the Biller in the external platform.
        code:
          type: string
          description: The code of the Biller in the external platform.
      description: >-
        References about the biller from external platforms Adfin integrates
        with.
    BillerResponse:
      required:
        - alias
        - countryCode
        - currencyCode
        - id
        - legalEntityType
        - name
        - registrationNo
        - statementName
        - status
        - timezone
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the biller.
        name:
          maxLength: 255
          minLength: 0
          type: string
          description: The legal registration name of the company.
        statementName:
          maxLength: 22
          minLength: 0
          type: string
          description: The biller statement name shown on bank and credit card statements.
        alias:
          maxLength: 50
          minLength: 0
          type: string
          description: The short name of the biller.
        registrationNo:
          type: string
          description: The registration number of the company.
        currencyCode:
          type: string
          description: >-
            The default currency of the biller.. 

            Possible values (non-exclusive): AED, AFN, ALL, AMD, ANG, AOA, ARS,
            AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL,
            BSD, BTN, BWP, BYR, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC,
            CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP,
            GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG,
            HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES,
            KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL,
            LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MUR, MVR, MWK, MXN,
            MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP,
            PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK,
            SGD, SHP, SLL, SOS, SPL, SRD, STD, SVC, SYP, SZL, THB, TJS, TMT,
            TND, TOP, TRY, TTD, TVD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF,
            VND, VUV, WST, XAF, XCD, XDR, XOF, XPF, YER, ZAR, ZMW, ZWD
        countryCode:
          type: string
          description: The default country code of the biller.
        timezone:
          type: string
          description: The default timezone of the biller.
        website:
          type: string
          description: The website of the biller.
        categoryCode:
          type: string
          description: The merchant category code (MCC) representing the business type.
        industryCode:
          type: string
          description: The industry code that represents the industry of the biller.
        legalEntityType:
          type: string
          description: |-
            The legal entity type of the biller.. 
            Possible values (non-exclusive): organization, soleProprietorship
        vatRegistrationNo:
          type: string
          description: The VAT registration number of the biller.
        billingEmail:
          type: string
          description: The email address for billing purposes.
        emailDomain:
          type: string
          description: The email domain of the biller.
        paymentDetails:
          type: array
          description: The list of payment details associated with the biller.
          items:
            $ref: '#/components/schemas/PaymentDetails'
        bankAccounts:
          type: array
          description: The list of bank accounts associated with the biller.
          items:
            $ref: '#/components/schemas/BankAccountResponse'
        locations:
          type: array
          description: The registered business locations of the biller.
          items:
            $ref: '#/components/schemas/Location'
        status:
          type: string
          description: >-
            The status of the biller. 

            Possible values (non-exclusive): PENDING, VERIFIED, ACTIVE,
            INACTIVE, LAPSED, BLACKLISTED
        channelBillerId:
          type: string
          description: The identifier of the biller associated with the payment provider.
        paymentSettings:
          $ref: '#/components/schemas/PaymentSettingsResponse'
        accountingSettings:
          $ref: '#/components/schemas/AccountingSettingsResponse'
        externalData:
          type: array
          description: >-
            References about this biller from external platforms Adfin
            integrates with, such as ID, etc.
          items:
            $ref: '#/components/schemas/BillerExternalData'
    CollectionMethodSetting:
      type: object
      properties:
        externalId:
          type: string
          description: >-
            The unique identifier of the collection method setting, such as a
            QuickBooks invoice term or a Xero branding theme ID. This value is
            used to match against the corresponding configuration in the
            external accounting platform.
        type:
          type: string
          description: |-
            The type of setting used to determine the collection method.. 
            Possible values (non-exclusive): TERM, BRANDING_THEME
      description: >-
        A single setting (e.g. term or branding theme) used to define a
        collection method for an invoice.
    CollectionMethodSettings:
      type: object
      properties:
        onDemand:
          type: array
          description: The list of settings that configure on demand payment collection.
          items:
            $ref: '#/components/schemas/CollectionMethodSetting'
        autoCollect:
          type: array
          description: The list of settings that configure auto collect payment collection.
          items:
            $ref: '#/components/schemas/CollectionMethodSetting'
      description: >-
        Settings used to determine how payments are collected (e.g. on demand or
        auto collect).
    Location:
      type: object
      properties:
        address:
          $ref: '#/components/schemas/Address'
        person:
          $ref: '#/components/schemas/Person'
      description: The location of the biller.
    PaymentDetails:
      type: object
      properties:
        bankName:
          type: string
          description: The name of the bank.
        sortCode:
          type: string
          description: The sort code, without separators or whitespace.
        accountNo:
          type: string
          description: The bank account number (without separators).
        accountType:
          type: string
          description: 'The account type. For example: Main Account.'
      description: The payment details of the biller.
    PaymentMethodResponse:
      required:
        - allowed
        - amountLimits
        - enabled
        - paymentMethod
        - status
      type: object
      properties:
        paymentMethod:
          type: string
          description: >-
            Payment method types. 

            Possible values (non-exclusive): BANK_PAYMENT, CARD, APPLE_PAY,
            GOOGLE_PAY, DIRECT_DEBIT, IMPORTED, MANUAL_BANK_TRANSFER,
            BANK_TRANSFER, AMEX
        enabled:
          type: boolean
          description: >-
            Indicates whether the payment method is enabled (true) or disabled
            (false).
        allowed:
          type: boolean
          description: >-
            Indicates whether receiving payments via provided payment method is
            allowed.
        status:
          type: string
          description: |-
            Statuses for payment method. 
            Possible values (non-exclusive): ACTIVE, INACTIVE
        amountLimits:
          type: array
          description: The amount limits
          items:
            $ref: '#/components/schemas/AmountLimitResponse'
      description: Payment method details
    PaymentSettingsResponse:
      required:
        - entityId
        - entityType
        - paymentMethods
        - status
      type: object
      properties:
        status:
          type: string
          description: >-
            The current status of payment settings, indicating if the payments
            can be processed or not.. 

            Possible values (non-exclusive): ACTIVE, INACTIVE
        paymentMethods:
          type: array
          description: The list of payment methods
          items:
            $ref: '#/components/schemas/PaymentMethodResponse'
        entityId:
          type: string
          description: >-
            The internal id of the entity for whom this payment setting was
            created.
        entityType:
          type: string
          description: >-
            Attribute that specifies the type of entity. 

            Possible values (non-exclusive): BILLER, CUSTOMER, INVOICE,
            PAYMENT_REQUEST
      description: Payment settings response details
    WebhooksResponse:
      type: object
      properties:
        webhooksResponse:
          type: array
          description: The list of webhooks for an application identifier.
          items:
            $ref: '#/components/schemas/WebhookResponse'
      description: The list of webhooks configured for an application.
  securitySchemes:
    Biller Access Token (Production):
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.adfin.com/api/oauth2/token
          scopes: {}
    Platform Bearer Token:
      type: http
      scheme: Bearer
    Biller Access Token (Staging):
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.staging.adfin.com/api/oauth2/token
          scopes: {}
