> ## 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/members/{memberId}/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/members/{memberId}/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.
      parameters:
        - name: memberId
          in: path
          description: The id of the member, max length 36.
          required: true
          schema:
            maxLength: 36
            type: string
        - name: accountType
          in: query
          description: The type of the account of the member.
          schema:
            type: string
      requestBody:
        description: Operation details.
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/Accounting.Api.Controllers.Service2Service.Models.CreateMemberTransactionRequest
          text/json:
            schema:
              $ref: >-
                #/components/schemas/Accounting.Api.Controllers.Service2Service.Models.CreateMemberTransactionRequest
          application/*+json:
            schema:
              $ref: >-
                #/components/schemas/Accounting.Api.Controllers.Service2Service.Models.CreateMemberTransactionRequest
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Accounting.Api.CQRS.Commands.CreateTransactionUsingMemberAccount.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.CreateMemberTransactionRequest:
      required:
        - amount
        - instantCapture
        - operationId
        - transactionType
      type: object
      properties:
        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
        transactionType:
          minLength: 1
          type: string
          description: 'Type of the transaction (like: FixedBonus, EmployeeBonus, ...).'
        instantCapture:
          type: boolean
          description: Indicates whether a capture of the reservation is instantaneous.
        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
        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.CreateTransactionUsingMemberAccount.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

````