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

# Create Bill Payments

> Create a new bill payment in the database.

The **Bill Payments** Data Model is designed to standardise and simplify the management of bill payment information across various accounting platforms.

## Additional Required Fields

To successfully create a bill payment, certain fields must be included in the raw\_data object of the request body. The required fields are as follows:

| Integration       | Field                | Description                    |
| ----------------- | -------------------- | ------------------------------ |
| MS\_DYNAMICS\_365 | payment\_journal\_id | The ID of the payment journal. |


## OpenAPI

````yaml POST /accounting/bill_payments
openapi: 3.0.1
info:
  title: rootfi
  version: v2
servers:
  - url: https://api.rootfi.dev
    description: Production
security: []
paths:
  /accounting/bill_payments:
    post:
      tags:
        - AccountingBillPayment
      summary: Create Bill Payment
      description: Add a bill payment.
      operationId: accounting_billPayment_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accountingtypesCreateBillPaymentRequest'
            examples:
              Example1:
                value:
                  company_id: 1
                  data:
                    - bill_id: '123456'
                      contact_id: '123456'
                      amount: 100
                      account_id: '123456'
                      payment_date: '2021-09-28T15:00:00.000Z'
                      document_number: ROOTFI01
                      memo: Test Memo
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accountingtypesCreateBillPaymentResponse'
              examples:
                Example1:
                  value:
                    data:
                      status: SUCCESS
                      upload_job_id: xQm2K441VosP8W4
                      data:
                        - job_id: aXI9pUDA5T7E2LS
                          status: success
                          response:
                            platform_id: '3770712000001669018'
                            payment_id: '3770712000001669016'
                            bill_id: '3770712000000319001'
                            contact_id: '3770712000000209007'
                            credit_note_id: '3770712000001669016'
                            account_id: '3770712000000000361'
                            currency_id: '3770712000000000099'
                            amount: 1234
                            payment_date: '2023-03-01T00:00:00.000Z'
                            payment_mode: Cash
                            currency_rate: 12
                            document_number: S69
                            memo: Payment for the Bill
                            updated_at: '2023-11-01T00:00:00.000Z'
                            raw_data:
                              platform_id: '123456'
                              nominal_code: Rootfi 01
                              name: Test Account
                              description: Test Description
                              category: LIABILITY
                              sub_category: Long Term Liabilities
                              status: ACTIVE
                          error: null
                    request_timestamp: '2021-09-28T15:00:00.000Z'
                    response_timestamp: '2021-09-28T15:00:00.000Z'
                    request_id: b2e791f5-7384-4e4f-800f-5c032f6bb61b
      security:
        - ApiKeyAuth: []
components:
  schemas:
    accountingtypesCreateBillPaymentRequest:
      title: accountingtypesCreateBillPaymentRequest
      type: object
      properties:
        company_id:
          type: integer
          example: 1
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesBillPaymentsWriteRequestFields'
      required:
        - company_id
        - data
    accountingtypesCreateBillPaymentResponse:
      title: accountingtypesCreateBillPaymentResponse
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/accountingtypesFinalCreateBillPaymentResponse'
        - $ref: '#/components/schemas/timestamp'
    accountingtypesBillPaymentsWriteRequestFields:
      title: accountingtypesBillPaymentsWriteRequestFields
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            A JSON containing fields that you can directly pass to the
            accounting platform.
      allOf:
        - $ref: >-
            #/components/schemas/accountingtypesBillPaymentsAllResponseCommonFields
    accountingtypesFinalCreateBillPaymentResponse:
      title: accountingtypesFinalCreateBillPaymentResponse
      type: object
      properties:
        data:
          $ref: '#/components/schemas/accountingtypesCreateBillpaymentResponseData'
      required:
        - data
    timestamp:
      title: timestamp
      type: object
      properties:
        request_timestamp:
          type: string
          format: date-time
          description: The time at which the request was received by the server
        response_timestamp:
          type: string
          format: date-time
          description: The time at which the response was sent by the server
        request_id:
          type: string
          description: The unique ID of the request
      required:
        - request_timestamp
        - response_timestamp
        - request_id
    accountingtypesBillPaymentsAllResponseCommonFields:
      title: accountingtypesBillPaymentsAllResponseCommonFields
      type: object
      properties:
        bill_id:
          type: string
          nullable: true
          description: >-
            The accounting platform’s unique identifier for the bill associated
            with this bill payment
        contact_id:
          type: string
          nullable: true
          description: >-
            The accounting platform’s unique identifier for the contact
            associated with this bill payment
        account_id:
          type: string
          nullable: true
          description: >-
            The accounting platform’s unique identifier for the account
            associated with this bill payment
        credit_note_id:
          type: string
          nullable: true
          description: >-
            The accounting platform’s unique identifier for the credit note
            associated with this bill payment
        currency_id:
          type: string
          nullable: true
          description: >-
            The accounting platform’s unique identifier for the currency
            associated with this bill payment
        amount:
          type: number
          format: double
          description: The amount of the bill payment
        payment_date:
          type: string
          nullable: true
          description: The date of the bill payment
        payment_mode:
          type: string
          nullable: true
          description: The payment mode of the bill payment
        currency_rate:
          type: number
          format: double
          nullable: true
          description: Rate between the currency of the bill and the base currency
        document_number:
          type: string
          nullable: true
          description: Reference number for the bill payment
        memo:
          type: string
          nullable: true
          description: Description of the bill payment
      required:
        - amount
    accountingtypesCreateBillpaymentResponseData:
      title: accountingtypesCreateBillpaymentResponseData
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesBillPaymentsResponsee'
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/SuccessResponse'
    accountingtypesBillPaymentsResponsee:
      title: accountingtypesBillPaymentsResponsee
      type: object
      properties:
        response:
          $ref: '#/components/schemas/accountingtypesBillPaymentsWriteResponseFields'
        error:
          $ref: '#/components/schemas/ErrorObject'
          nullable: true
          description: The error message if the job failed.
      required:
        - response
      allOf:
        - $ref: '#/components/schemas/JobSuccessResponse'
    SuccessResponse:
      title: SuccessResponse
      type: object
      properties:
        status:
          $ref: '#/components/schemas/Status'
          description: The status of the job.
        upload_job_id:
          type: string
          description: The ID of the job.
      required:
        - status
        - upload_job_id
    accountingtypesBillPaymentsWriteResponseFields:
      title: accountingtypesBillPaymentsWriteResponseFields
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            The raw JSON response we get from the accounting platform for that
            data
      allOf:
        - $ref: '#/components/schemas/accountingtypesBillPaymentsResponseFields'
    ErrorObject:
      title: ErrorObject
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        platform_error:
          type: string
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
      required:
        - code
        - message
        - platform_error
    JobSuccessResponse:
      title: JobSuccessResponse
      type: object
      properties:
        job_id:
          type: string
          description: The ID of the job.
        status:
          $ref: '#/components/schemas/JobResponseStatus'
          description: The status of the job.
      required:
        - job_id
        - status
    Status:
      title: Status
      type: string
      enum:
        - SUCCESS
        - FAILED
        - CREATED
        - RUNNING
    accountingtypesBillPaymentsResponseFields:
      title: accountingtypesBillPaymentsResponseFields
      type: object
      properties:
        updated_at:
          type: string
          nullable: true
          description: The last ISO 8601 timestamp that the data was updated at
      allOf:
        - $ref: '#/components/schemas/accountingtypesBillPaymentsPlatformId'
        - $ref: '#/components/schemas/accountingtypesBillPaymentsPaymentID'
        - $ref: >-
            #/components/schemas/accountingtypesBillPaymentsAllResponseCommonFields
    JobResponseStatus:
      title: JobResponseStatus
      type: string
      enum:
        - success
        - failed
    accountingtypesBillPaymentsPlatformId:
      title: accountingtypesBillPaymentsPlatformId
      type: object
      properties:
        platform_id:
          type: string
          description: The ID that the accounting platform uses to identify this account
      required:
        - platform_id
    accountingtypesBillPaymentsPaymentID:
      title: accountingtypesBillPaymentsPaymentID
      type: object
      properties:
        payment_id:
          type: string
          nullable: true
          description: The ID that the accounting platform uses to identify this account
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````