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

# Create Product Transaction Endpoint

> This API endpoint allows you to create a product transaction within the supply chain system. By sending a POST request to the specified endpoint, you can initiate a product transaction, including transaction payments and submission details.



## OpenAPI

````yaml post /transactions/product-transactions/
openapi: 3.0.1
info:
  title: Trace Connect API
  version: v1
servers:
  - url: http://localhost:3000/connect/v1
security:
  - Bearer: []
paths:
  /transactions/product-transactions/:
    post:
      tags:
        - transactions
      operationId: transactions_product-transactions_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductTransaction'
        required: true
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductTransaction'
components:
  schemas:
    ProductTransaction:
      required:
        - amount
        - destination
        - product
        - source
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the transaction.
        transaction_payments:
          type: array
          items:
            $ref: '#/components/schemas/PaymentTransactions'
          description: >-
            Array of payment transactions associated with the product
            transaction.
        amount:
          title: Amount
          type: string
          format: decimal
          description: The amount of the transaction.
        currency:
          title: Currency
          minLength: 1
          type: string
          description: The currency used in the transaction.
        type:
          title: Type
          type: string
          readOnly: true
          description: The type of the transaction.
        source_quantity:
          title: Source quantity
          type: string
          format: decimal
          readOnly: true
          description: The quantity from the source in the transaction.
        current_quantity:
          title: Current quantity
          type: string
          format: decimal
          readOnly: true
          description: The current quantity in the transaction.
        submissions:
          type: array
          items:
            $ref: '#/components/schemas/Submission'
          description: Array of submissions associated with the product transaction.
        card_details:
          $ref: '#/components/schemas/ConnectCard'
          description: Details of the card used in the transaction.
        currency_details:
          $ref: '#/components/schemas/Currency'
          description: Details of the currency used in the transaction.
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
          description: Date and time when the transaction was last updated.
        number:
          title: Number
          maxLength: 10
          type: string
          nullable: true
          description: The number associated with the transaction.
        created_on:
          title: Created On
          type: string
          format: date-time
          description: Date and time when the transaction was created.
        date:
          title: Date
          type: string
          format: date-time
          description: The date of the transaction.
        invoice:
          title: Invoice
          type: string
          format: uri
          nullable: true
          readOnly: true
          description: The invoice associated with the transaction.
        invoice_number:
          title: Invoice Number
          maxLength: 100
          type: string
          nullable: true
          description: The invoice number associated with the transaction.
        verification_latitude:
          title: Verification Latitude
          type: number
          description: The latitude of verification in the transaction.
        verification_longitude:
          title: Verification Longitude
          type: number
          description: The longitude of verification in the transaction.
        method:
          title: Method
          type: string
          nullable: true
          enum:
            - CARD
            - INVOICE
            - NONE
          description: The method used in the transaction.
        quality_correction:
          title: Quality Correction
          type: number
          description: The quality correction value in the transaction.
        quantity:
          title: Quantity
          type: string
          format: decimal
          nullable: true
          description: The quantity associated with the transaction.
        creator:
          type: string
          description: Identifier of the user who created the transaction.
        updater:
          type: string
          description: Identifier of the user who last updated the transaction.
        source:
          type: string
          description: The source of the transaction.
        destination:
          type: string
          description: The destination of the transaction.
        card:
          type: string
          description: The card used in the transaction.
        product:
          type: string
          description: The product associated with the transaction.
        parents:
          uniqueItems: true
          type: array
          items:
            type: string
          description: >-
            Array of parent transactions associated with the product
            transaction.
    PaymentTransactions:
      required:
        - destination
        - source
      type: object
      properties:
        id:
          type: string
        premium_details:
          $ref: '#/components/schemas/Premium'
        currency_details:
          $ref: '#/components/schemas/Currency'
        type:
          title: Type
          type: string
          readOnly: true
        currency:
          title: Currency
          minLength: 1
          type: string
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        number:
          title: Number
          maxLength: 10
          type: string
          nullable: true
        created_on:
          title: Created On
          type: string
          format: date-time
        date:
          title: Date
          type: string
          format: date-time
        invoice:
          title: Invoice
          type: string
          format: uri
          nullable: true
          readOnly: true
        invoice_number:
          title: Invoice Number
          maxLength: 100
          type: string
          nullable: true
        verification_latitude:
          title: Verification Latitude
          type: number
        verification_longitude:
          title: Verification Longitude
          type: number
        method:
          title: Method
          type: string
          nullable: true
          enum:
            - CARD
            - INVOICE
            - NONE
        payment_type:
          title: Payment Type
          type: string
          enum:
            - TRANSACTION
            - PREMIUM
            - TRANSACTION_PREMIUM
        amount:
          title: Amount
          type: number
        selected_option:
          title: Selected Option
          maxLength: 100
          type: string
          nullable: true
        creator:
          type: string
        updater:
          type: string
        source:
          type: string
        destination:
          type: string
        card:
          type: string
        premium:
          type: string
        transaction:
          type: string
        submissions:
          uniqueItems: true
          type: array
          items:
            type: string
    Submission:
      required:
        - form
        - values
      type: object
      properties:
        id:
          type: string
        form_details:
          $ref: '#/components/schemas/Form'
        values:
          type: array
          items:
            $ref: '#/components/schemas/SubmissionValues'
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        creator:
          type: string
        updater:
          type: string
        form:
          type: string
        product:
          type: string
    ConnectCard:
      required:
        - card_id
      type: object
      properties:
        id:
          type: string
        card_id:
          title: Card id
          minLength: 1
          type: string
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        display_id:
          title: Display ID
          maxLength: 100
          type: string
          nullable: true
        creator:
          type: string
        updater:
          type: string
    Currency:
      required:
        - name
      type: object
      properties:
        id:
          type: string
        name:
          title: Currency Name
          maxLength: 1000
          minLength: 1
          type: string
        code:
          title: Currency Code
          maxLength: 100
          type: string
          nullable: true
    Premium:
      required:
        - name
      type: object
      properties:
        id:
          type: string
        options:
          type: array
          items:
            $ref: '#/components/schemas/PremiumOptionSeriazer'
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        category:
          title: Premium Category
          type: string
          enum:
            - PAYOUT
            - TRANSACTION
        name:
          title: Premium Name
          maxLength: 100
          minLength: 1
          type: string
        type:
          title: Premium Type
          type: string
          enum:
            - PER_TRANSACTION
            - PER_KG
            - PER_UNIT_CURRENCY
            - PER_FARMER
        amount:
          title: Amount
          type: number
          nullable: true
        included:
          title: Included
          type: boolean
        dependant_on_card:
          title: Dependant on Card
          type: boolean
        applicable_activity:
          title: Applicable Activity
          type: string
          enum:
            - BUY
            - SELL
        calculation_type:
          title: Calculation Type
          type: string
          enum:
            - NORMAL
            - MANUAL
            - OPTIONS
        is_active:
          title: Is Active
          type: boolean
        creator:
          type: string
        updater:
          type: string
        owner:
          type: string
    Form:
      required:
        - fields
        - owner
      type: object
      properties:
        id:
          type: string
        products:
          type: array
          readOnly: true
          items:
            $ref: '#/components/schemas/Product'
        fields:
          type: array
          items:
            $ref: '#/components/schemas/FormField'
        field_config:
          type: array
          items:
            $ref: '#/components/schemas/FormFieldConfig'
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        form_type:
          title: Form Type
          type: string
          enum:
            - TRANSACTION
            - FARMER
            - PAYMENT
            - PRODUCT
        creator:
          type: string
        updater:
          type: string
        owner:
          type: string
    SubmissionValues:
      required:
        - field
        - value
      type: object
      properties:
        id:
          type: string
        field_details:
          $ref: '#/components/schemas/FormField'
        field:
          title: Field
          minLength: 1
          type: string
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        value:
          title: Value
          maxLength: 100
          minLength: 1
          type: string
        creator:
          type: string
        updater:
          type: string
    PremiumOptionSeriazer:
      required:
        - amount
        - name
      type: object
      properties:
        id:
          type: string
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        name:
          title: Option Name
          maxLength: 25
          minLength: 1
          type: string
        amount:
          title: Amount
          type: number
        is_active:
          title: Is Active
          type: boolean
        creator:
          type: string
        updater:
          type: string
    Product:
      required:
        - name
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the product.
        premiums:
          title: Premiums
          type: string
          readOnly: true
          description: Premiums associated with the product.
        is_active:
          title: Is active
          type: string
          readOnly: true
          description: Indicates whether the product is currently active.
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
          description: Date and time when the product information was last updated.
        created_on:
          title: Created On
          type: string
          format: date-time
          readOnly: true
          description: Date and time when the product was created.
        name:
          title: Product Name
          maxLength: 500
          minLength: 1
          type: string
          description: Name of the product.
        description:
          title: Product Description
          maxLength: 500
          type: string
          nullable: true
          description: Description of the product.
        image:
          title: Product Image
          type: string
          format: uri
          nullable: true
          readOnly: true
          description: URL to the image or photo of the product.
        creator:
          type: string
          description: Identifier of the user who created the product.
        updater:
          type: string
          description: Identifier of the user who last updated the product.
    FormField:
      required:
        - label
        - type
      type: object
      properties:
        id:
          type: string
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        label:
          title: Label
          maxLength: 100
          minLength: 1
          type: string
        label_en_us:
          title: Label [en-us]
          maxLength: 100
          type: string
          nullable: true
        label_en_uk:
          title: Label [en-uk]
          maxLength: 100
          type: string
          nullable: true
        label_fr:
          title: Label [fr]
          maxLength: 100
          type: string
          nullable: true
        label_nl:
          title: Label [nl]
          maxLength: 100
          type: string
          nullable: true
        label_ind:
          title: Label [ind]
          maxLength: 100
          type: string
          nullable: true
        type:
          title: Field Type
          type: string
          enum:
            - TEXT
            - INTEGER
            - FLOAT
            - RADIO
            - MULTI_SELECT
            - EMAIL
            - PHONE
            - DATE
            - BOOLEAN
            - DROPDOWN
        key:
          title: Key
          maxLength: 100
          type: string
          nullable: true
        required:
          title: Required
          type: boolean
        default_value:
          title: Default Value
          maxLength: 100
          type: string
          nullable: true
        options:
          title: Options
          type: string
          nullable: true
        creator:
          type: string
        updater:
          type: string
    FormFieldConfig:
      required:
        - key
        - label
      type: object
      properties:
        id:
          type: string
        updated_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        created_on:
          title: Updated On
          type: string
          format: date-time
          readOnly: true
        label:
          title: Label
          maxLength: 100
          minLength: 1
          type: string
        key:
          title: Key
          maxLength: 100
          minLength: 1
          type: string
        visibility:
          title: Visibility
          type: boolean
        required:
          title: Required
          type: boolean
        creator:
          type: string
        updater:
          type: string
  securitySchemes:
    Bearer:
      type: apiKey
      name: Authorization
      in: header

````