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

# Create transaction

> Create a new transaction for a user



## OpenAPI

````yaml /openapi/embedded-consumer-wallets.yaml post /v1/users/{userId}/transactions
openapi: 3.0.0
info:
  description: APIs for interacting with Cadana Embedded Consumer Wallets
  version: 1.0.0
  title: Embedded Consumer Wallets
  termsOfService: https://cadanapay.com/terms-and-conditions
  contact:
    email: api@cadanapay.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.cadanapay.com
    description: Prod Server
  - url: https://dev-api.cadanapay.com
    description: Dev Server
security:
  - Authorization: []
tags:
  - name: Beneficiaries
    description: APIs for managing user beneficiaries
  - name: Transactions
    description: APIs for managing user transactions
  - name: Balances
    description: APIs for managing user account balances
paths:
  /v1/users/{userId}/transactions:
    post:
      tags:
        - Transactions
      summary: Create transaction
      description: Create a new transaction for a user
      parameters:
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/XMultiTenantKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTransactionRequest'
            examples:
              payoutWithDestinationAmount:
                summary: >-
                  Payout with destination amount - send exactly 500 PHP to the
                  beneficiary
                value:
                  type: payout
                  beneficiaryId: c871b333-e129-409c-aabd-7cfb55a967cc
                  quoteId: d35d2bd6-188b-4e82-9a16-71442dad7375
                  amount:
                    value: '500.00'
                    currency: PHP
                  sourceCurrency: USD
                  reference: 3f70be8e-426f-4e89-b883-9c97a1c334d5
              payoutWithSourceAmount:
                summary: >-
                  Payout with source amount - send 10 USD worth to the
                  beneficiary
                value:
                  type: payout
                  beneficiaryId: c871b333-e129-409c-aabd-7cfb55a967cc
                  quoteId: d35d2bd6-188b-4e82-9a16-71442dad7375
                  sourceAmount:
                    value: '10.00'
                    currency: USD
                  reference: 7a7f80a6-1665-4f64-9ef3-d5f90f8f309b
      responses:
        '200':
          $ref: '#/components/responses/CreateTransactionResponse'
        '400':
          $ref: '#/components/responses/BadRequestError'
        5XX:
          $ref: '#/components/responses/InternalError'
      security:
        - Authorization: []
components:
  parameters:
    userId:
      name: userId
      in: path
      description: The unique identifier for the user
      required: true
      schema:
        type: string
        format: uuid
        example: c06f3427-3bbe-4d70-9a54-28acda267e48
    XMultiTenantKey:
      name: X-MultiTenantKey
      in: header
      required: false
      schema:
        type: string
      description: >-
        Required when using a Platform API token. The tenant key identifying
        which business to operate on.
  schemas:
    CreateTransactionRequest:
      type: object
      required:
        - type
        - beneficiaryId
        - quoteId
        - reference
      properties:
        type:
          type: string
          enum:
            - payout
            - savings_funding
          description: The type of transaction
          example: payout
        beneficiaryId:
          type: string
          format: uuid
          example: c871b333-e129-409c-aabd-7cfb55a967cc
        quoteId:
          type: string
          format: uuid
          description: The unique identifier for the fx quote
          example: d35d2bd6-188b-4e82-9a16-71442dad7375
        amount:
          $ref: '#/components/schemas/Amount'
          description: >-
            The destination amount (required if sourceAmount is not provided).
            When using this field, sourceCurrency is also required.
        sourceAmount:
          $ref: '#/components/schemas/Amount'
          description: >-
            The source amount (required if amount is not provided). The currency
            in this amount object represents the source currency.
        sourceCurrency:
          type: string
          description: >-
            The source currency code. Required when using the amount field
            (destination amount).
          example: USD
        reference:
          type: string
          format: uuid
          description: The client reference for the transaction
          example: c06f3427-3bbe-4d70-9a54-28acda267e48
      oneOf:
        - required:
            - amount
            - sourceCurrency
        - required:
            - sourceAmount
    Amount:
      type: object
      required:
        - value
        - currency
      properties:
        value:
          type: string
          description: The value of the amount
          example: '10.00'
        currency:
          type: string
          description: The currency of the asset
          example: USD
    BadRequestError:
      description: Bad input provided by client
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          properties:
            params:
              description: A map for meta data around the error that occurred
              type: object
      example:
        code: invalid_request_body
        message: The request body provided is not valid
        params:
          field: Value is invalid.
    InternalError:
      description: Internal server error
      allOf:
        - $ref: '#/components/schemas/Error'
      example:
        code: internal_error
        message: An unexpected error occurred. Please try again later.
    Error:
      type: object
      properties:
        code:
          description: A machine parsable error code
          type: string
          enum:
            - invalid_request_body
            - resource_not_found
            - forbidden
            - internal_error
        message:
          description: A human readable message describing the error
          type: string
  responses:
    CreateTransactionResponse:
      description: Transaction created response
      content:
        application/json:
          schema:
            type: object
            properties:
              id:
                type: string
                format: uuid
                example: d0137ede-7df1-4a54-8206-b3ab7b03876f
          examples:
            transaction:
              summary: Example transaction creation response
              value:
                id: d0137ede-7df1-4a54-8206-b3ab7b03876f
    BadRequestError:
      description: Bad input provided by client
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequestError'
    InternalError:
      description: Internal error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalError'
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      bearerFormat: API_SECRET_KEY

````