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

# Book payment

## Field support per integration

> [accordion] Business Central
>
> > [!WARNING]
> >
> > This endpoint needs the Maesn app to be installed in the Business Central environment. If the app is not installed, Business Central returns an error.
> > Please get in touch with your contact person at maesn to get the app.
>
> > [!NOTE]
> >
> > If you're not using the [Interactive Authentication Flow](https://docs.maesn.com/authentication.md#interactive-authentication-flow), make sure the query parameters `environmentName` and `companyId` are correctly populated.
> > You can obtain these values by using the `GET Environments` and `GET Companies` endpoints available under the Authentication section.
>
> Books a payment that was created with [POST /payments](https://docs.maesn.com/api-reference/accounting-endpoints/payments/create-payment.md). Until it is booked, the payment does not reduce the open amount of the invoice.
>
> Path parameters:
>
> **paymentId** `string` *required*
>
> The id of the payment you want to book.

> [accordion] sevdesk
>
> Links a payment that was created with [POST /payments](https://docs.maesn.com/api-reference/accounting-endpoints/payments/create-payment.md) to an invoice or voucher. The amount, date and bank account are taken from the payment.
>
> Supported request parameters:
>
> **documentType** `enum` *required*
>
> Available options: `INVOICE`, `BOOKING_PROPOSAL`
>
> **documentId** `string` *required*
>
> The id of the invoice or voucher.


## OpenAPI

````yaml post /accounting/payments/{paymentId}/book
openapi: 3.0.0
info:
  title: Maesn unified API
  description: The Maesn unified API description
  version: '1.0'
  contact: {}
servers:
  - url: https://api.maesn.dev
security: []
tags:
  - name: maesn
    description: ''
paths:
  /accounting/payments/{paymentId}/book:
    post:
      tags:
        - accounting
      operationId: bookPayment
      parameters:
        - name: paymentId
          required: true
          in: path
          schema:
            type: string
        - name: companyId
          required: false
          in: query
          schema:
            type: string
        - name: environmentName
          in: query
          schema:
            type: string
          required: false
        - name: X-API-KEY
          description: API key
          in: header
          schema:
            type: string
            example: example value
          required: true
        - name: X-ACCOUNT-KEY
          description: Account key
          in: header
          schema:
            type: string
            example: example value
          required: true
      requestBody:
        required: false
        description: sevdesk requires a document type and ID.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BookPaymentRequestDto'
      responses:
        '201':
          description: Payment booked successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    $ref: '#/components/schemas/MetaResponse'
                  data:
                    type: string
                    example: Payment booked
components:
  schemas:
    BookPaymentRequestDto:
      type: object
      properties:
        documentType:
          type: string
          enum:
            - INVOICE
            - BILL
            - BOOKING_PROPOSAL
            - INVOICE_BOOKING_PROPOSAL
            - BILL_BOOKING_PROPOSAL
          example: INVOICE
        documentId:
          type: string
          example: '42'
    MetaResponse:
      type: object
      properties:
        warnings:
          type: array
          items:
            type: string
            example: Field not used by target system
        pagination:
          $ref: '#/components/schemas/PaginationResponse'
        partialErrors:
          type: array
          description: >-
            Secondary operations that failed after the main operation succeeded.
            See [Partial Errors](/guides/partial-errors).
          items:
            type: object
            properties:
              code:
                type: string
                example: FILE_UPLOAD_FAILED
              message:
                type: string
                example: >-
                  Attachment invoice.pdf could not be uploaded to the target
                  system.
    PaginationResponse:
      type: object
      properties:
        total:
          type: number
          example: 125
        perPage:
          type: number
          example: 50
        currentPage:
          type: number
          example: 1
        totalPages:
          type: number
          example: 3

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.