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

# Post payment to given invoice

> Creates a payment transaction that is allocated to the specified invoice.

Transaction type is derived:
- CPT if invoice is in collection
- PT otherwise

Note: The additionalInfo.paymentReference field is prohibited in this request.




## OpenAPI

````yaml transaction post /v3/invoice/{invoiceId}/payment
openapi: 3.0.3
info:
  description: |
    Endpoints for managing transaction data
  version: '1'
  title: Transaction details API
  contact:
    name: Enfuce Financial Services
    url: https://enfuce.com
    email: info@enfuce.com
  x-logo:
    url: https://developer.enfuce.com/images/enfuce.svg
    altText: Enfuce logo
servers:
  - url: >-
      https://integration-api-cat2.{{environment}}.ext.{{realm}}.cia.enfuce.com/transaction
  - url: https://integration-api-cat2.live.ext.prod.cia.enfuce.com/transaction
    description: Live environment
security: []
tags:
  - name: Create transactions
    description: >-
      <p>Endpoints for creating transactions</p><h2>Generic Fee Reimbursement
      transaction types</h2><p>For this case reimbursement is not linked to
      specific charged fee and amount of reimbursement should be provided.
      Generic reimbursement transaction types can be used to reimburse one or
      several fees.</p><p>There is a possibility to create reimbursement on
      account or on card level.</p><p>To create reimbursement on account level
      please POST transaction to given account with &quot;AR&quot; as type
      parameter.</p><p>To create reimbursement on card level please POST
      transaction to given card with &quot;RR&quot; as type parameter.</p><p>On
      account level there also supported interest reimbursement transactions
      with “IR” and “OR” types.</p>
  - name: Create fees
    description: <p>Endpoints for creating fees</p>
  - name: Get transaction data
    description: Endpoints for fetching transaction data
  - name: Update a transaction
    description: >-
      <p>Endpoint for updating a transaction.</p><p>This service enables refund
      of transactions including fees.</p><h2>Reversal of previously posted
      transaction</h2><p>This use case allows to link reimbursement with
      previously posted transaction, including fees.</p><p>To create this type
      of refund please use POST &quot;Update a Transaction&quot; endpoint and as
      &quot;id&quot; parameter please provide id of the transaction which should
      be reversed, and in &quot;propertyToUpdate&quot; please provide
      &quot;REVERSE&quot; value. Id can be found with &quot;Get
      transaction&quot; endpoints under &quot;id&quot; parameter of
      transaction.</p>
  - name: Batch payment
    description: |
      Batch file for payments.
      ### File name standard
      `payment_{institution_id}_yyyymmdd_hhmmss.json`
      ### File structure
      <SchemaDefinition schemaRef="#/components/schemas/BatchPayments" />
      ### Response file
  - name: Authorization Holds
    description: Endpoints for creating, reversing and clearing of authorization holds
paths:
  /v3/invoice/{invoiceId}/payment:
    post:
      tags:
        - Create transactions
      summary: Post payment to given invoice
      description: >
        Creates a payment transaction that is allocated to the specified
        invoice.


        Transaction type is derived:

        - CPT if invoice is in collection

        - PT otherwise


        Note: The additionalInfo.paymentReference field is prohibited in this
        request.
      operationId: postInvoicePaymentUsingPOST
      parameters:
        - name: invoiceId
          in: path
          required: true
          schema:
            type: string
            format: biginteger
          description: Invoice id to allocate the payment to
        - name: auditUser
          in: query
          description: The audit user to log the request
          required: true
          schema:
            type: string
      requestBody:
        $ref: '#/components/requestBodies/createInvoicePaymentResourceBody'
      responses:
        '201':
          description: Successful creation of payment transaction allocated to invoice
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/resourceResponse'
        '400':
          $ref: '#/components/responses/error400'
        '401':
          $ref: '#/components/responses/error401'
        '403':
          $ref: '#/components/responses/error403'
        '404':
          $ref: '#/components/responses/error404'
        '500':
          $ref: '#/components/responses/error500'
components:
  requestBodies:
    createInvoicePaymentResourceBody:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/createInvoicePaymentResourceBody'
      description: >-
        The fields that you want to apply to your newly created invoice payment
        transaction, these values will override the predefined template values.
        Note: Transaction type is derived by the backend and must not be
        provided.
      required: true
  schemas:
    resourceResponse:
      type: object
      properties:
        description:
          type: string
          description: >-
            When a payment is declined, a response description is returned, if
            available, providing more context on why the transaction failed.
            This includes a return code and a brief explanation. If multiple
            issues cause the decline, only one response description is sent; the
            most recent reason for decline is returned. <Note>If the payment is
            successful, the `resourceResponse` attribute is returned with `null`
            value.</Note>
          example: 061-Usage Limit '24H_RETAIL' Amount Exceeded
        id:
          type: string
          description: Will contain the ID of the resource that has been created or updated
      title: resourceResponse
    createInvoicePaymentResourceBody:
      type: object
      required:
        - amount
        - currency
      properties:
        amount:
          type: number
          description: >
            Transaction amount. It is possible to post only amount which is
            equal or more than minimal currency unit

            (For example, for EUR, SEK, NOK minimal unit is 0,01)
        currency:
          $ref: '#/components/schemas/currency'
        text:
          type: string
          maxLength: 255
          description: Free input text
        additionalInfo:
          $ref: '#/components/schemas/additionalInfo'
        transactionDetails:
          type: string
          description: Merchant name
          maxLength: 255
        date:
          type: string
          format: date
          description: >
            The date when transaction was posted at Enfuce in ISO-8601 date
            format (YYYY-MM-DD).

            Only one of date or postingDate can be used at a time.

            This field will always post a transaction even if this date is not
            valid.
        postingDate:
          type: string
          format: date
          description: >
            The date when transaction was posted at Enfuce in ISO-8601 date
            format (YYYY-MM-DD).

            Only one of date or postingDate can be used at a time.

            When using this field an exception will be thrown if posting date is
            not valid.

            For a postingDate to be valid, it must be no later than the due date
            of the account's contract.
        transactionDate:
          type: string
          format: date
          description: >
            The local date when the transaction was made in ISO-8601 date format
            (YYYY-MM-DD).
      title: createInvoicePaymentResourceBody
    errorResponse:
      type: object
      properties:
        code:
          type: string
          description: An error code indicating what kind of error. I.e. HTTP error code
        message:
          type: string
          description: Error message in human-readable format
        id:
          type: string
          format: uuid
          description: Unique error identifier
        errorCode:
          type: string
          description: Enfuce code for a specific error type
        errorType:
          type: string
          description: Error type
          enum:
            - STATIC_VALIDATION_ERROR
            - DYNAMIC_VALIDATION_ERROR
            - INTEGRATION_ERROR
            - SECURITY_ERROR
            - UNEXPECTED_ERROR
        errorReason:
          type: string
          description: Free-form text explaining the error reason
        timestamp:
          type: string
          format: date-time
          description: Datetime when error occurred
    currency:
      type: string
      description: A valid ISO 4217 currency code
      pattern: '[A-Z]{3}'
      example: EUR
    additionalInfo:
      type: object
      properties:
        ref:
          type: string
          description: Reference number
        message:
          type: string
          description: Message text field
        paymentReceiver:
          type: string
          description: Payment receiver name
        transferId:
          type: string
          description: Transfer id
        text:
          type: string
          description: Free text
        discLinkTransactionId:
          type: string
          description: >-
            The transactionId of the original financial transaction of this
            discount
        discLinkPurchaseDetailId:
          type: string
          description: >-
            The purchaseDetailsId of the original purchase detail of this
            discount
        paymentReference:
          type: string
          description: Reference number used for the transaction
        payerName:
          type: string
          description: First and last name of payer
        fromAddress:
          type: string
          description: Address of payer
        fromZip:
          type: string
          description: Zip code of payer
        fromCity:
          type: string
          description: City of payer
        fromBankAccountNumber:
          type: string
          description: Source account number
        fromCustomerAccountNumber:
          type: string
          description: from the Enfuce system, where the payment was posted
        fromOrganizationalNumber:
          type: string
          description: Sender Organizational number
        fromBankName:
          type: string
          description: Source bank name
        toBic:
          type: string
          description: Target BIC code, used for pain file generation
        fromBankAccountType:
          $ref: '#/components/schemas/bankAccountType'
        toBankAccountType:
          $ref: '#/components/schemas/bankAccountType'
        toBankAccountNumber:
          type: string
          description: Target account number
        fileName:
          type: string
          description: Name of processed file, typically for managing incoming payments.
        receivedFromCollectionAgency:
          type: boolean
          description: >-
            Whether a collection payment transaction (CPT) is received from a
            collection agency or not. Only applies to payment transactions for
            invoices in collection.
        vatRate:
          type: string
          description: Vat rate
        vatAmount:
          type: string
          description: Vat amount
        billNumber:
          type: string
          description: Bill number
      title: additionalInfo
    bankAccountType:
      type: string
      enum:
        - BBAN
        - IBAN
        - PLUSGIRO
        - BANKGIRO
      description: The type of bank account
  responses:
    error400:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorResponse'
    error401:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorResponse'
    error403:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorResponse'
    error404:
      description: Not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorResponse'
    error500:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorResponse'

````