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

# Create a transaction

> The transaction can be captured instantly if 'InstantCapture' parameter is set to true.
Accrues the specified amount on the member's active account.
The specified amount can be negative, then the amount will be deducted from the member's account.
The operation is idempotent.
            
Attention: CreatePayment endpoint must be used for a payment.



## OpenAPI

````yaml openapi/bonus-v1.json POST /v1/transactions
openapi: 3.0.4
info:
  title: Accounting.Api
  version: v1
servers:
  - url: https://{host}/bonus
    description: Your Lobyco environment
    variables:
      host:
        default: your-environment.lobyco.net
        description: >-
          The API host for your Lobyco environment. Replace it with the host you
          were given — this placeholder does not resolve.
security:
  - Bearer: []
paths:
  /v1/transactions:
    post:
      tags:
        - Service2Service
      summary: Create a transaction
      description: >-
        The transaction can be captured instantly if 'InstantCapture' parameter
        is set to true.

        Accrues the specified amount on the member's active account.

        The specified amount can be negative, then the amount will be deducted
        from the member's account.

        The operation is idempotent.
                    
        Attention: CreatePayment endpoint must be used for a payment.
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/Accounting.Api.Controllers.Service2Service.Models.CreateTransactionRequest
          text/json:
            schema:
              $ref: >-
                #/components/schemas/Accounting.Api.Controllers.Service2Service.Models.CreateTransactionRequest
          application/*+json:
            schema:
              $ref: >-
                #/components/schemas/Accounting.Api.Controllers.Service2Service.Models.CreateTransactionRequest
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Accounting.Api.CQRS.Commands.CreateTransaction.Response
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/LoopFoundation.Commons.Contracts.WebServiceError
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/LoopFoundation.Commons.Contracts.WebServiceError
components:
  schemas:
    Accounting.Api.Controllers.Service2Service.Models.CreateTransactionRequest:
      required:
        - operationId
        - transactionType
      type: object
      properties:
        toAccountId:
          type: integer
          description: Destination account Id
          format: int64
          nullable: true
        fromAccountId:
          type: integer
          description: Source account Id
          format: int64
          nullable: true
        accountExternalId:
          maxLength: 60
          type: string
          nullable: true
          deprecated: true
        operationId:
          maxLength: 128
          minLength: 1
          type: string
          description: >-
            Unique identifier of the operation (should be the same only for
            retries of the same operation).
        amount:
          type: number
          description: >-
            Amount to be reserved.

            Can be positive or negative.

            If the amount is positive, then the amount is added to the member's
            account.

            If the amount is negative, then the amount is subtracted from the
            member's account.
          format: double
          nullable: true
        transactionType:
          minLength: 1
          type: string
          description: 'Type of the transaction (like: FixedBonus, EmployeeBonus, ...).'
        metadata:
          type: object
          additionalProperties:
            nullable: true
          description: >-
            Set of key-value pairs that you can attach to a transaction.

            This can be useful for storing additional information about the
            transaction in a structured format.
          nullable: true
        instantCapture:
          type: boolean
          description: Indicates whether a capture of the reservation is instantaneous.
          default: true
          nullable: true
        expirationDate:
          type: string
          description: Optional expiration date
          format: date-time
          nullable: true
        autoCaptureDate:
          type: string
          description: >-
            Optional date of the automatic capture of the transaction

            This field should be sent with a value only if InstantCapture =
            false
          format: date-time
          nullable: true
      additionalProperties: false
    Accounting.Api.CQRS.Commands.CreateTransaction.Response:
      required:
        - amount
        - transactionId
      type: object
      properties:
        transactionId:
          type: integer
          description: Unique transaction id.
          format: int64
        amount:
          type: number
          description: Amount which has been reserved or captured.
          format: double
      additionalProperties: false
    LoopFoundation.Commons.Contracts.WebServiceError:
      required:
        - message
        - name
      type: object
      properties:
        name:
          minLength: 1
          type: string
        message:
          minLength: 1
          type: string
        details:
          nullable: true
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: apiKey
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        "Authorization: Bearer {token}"
      name: Authorization
      in: header

````