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

# Create a transaction

> Supports historical created_at values. product_id and product_name are stored and returned in product_ids and product_names arrays.



## OpenAPI

````yaml /api-reference/openapi.json post /v2/transactions
openapi: 3.1.0
info:
  title: Tolt Public API
  version: 2.0.0
servers:
  - url: https://platform.tolt.dev
    description: Development
security:
  - bearerAuth: []
paths:
  /v2/transactions:
    post:
      tags:
        - Transactions
      summary: Create a transaction
      description: >-
        Supports historical created_at values. product_id and product_name are
        stored and returned in product_ids and product_names arrays.
      operationId: createTransaction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                created_at:
                  type: string
                  format: date-time
                  description: >-
                    When the payment happened, as a timestamp with a time zone,
                    for example 2026-03-01T12:00:00Z. Reports and date filters
                    place the transaction on this date. Defaults to now.
                product_id:
                  type: string
                  maxLength: 255
                  description: >-
                    Id of the purchased product in your billing system.
                    Commission flows can match on it.
                product_name:
                  type: string
                  maxLength: 255
                  description: >-
                    Readable name of the purchased product, such as Pro plan. It
                    is saved as the transaction's product name, which
                    revenue_by_product groups revenue by; flows match on
                    product_id, not on this name.
                amount:
                  type: integer
                  minimum: 0
                  maximum: 9007199254740991
                  description: >-
                    The payment amount in the smallest unit of the program
                    currency (cents for USD); percentage commissions are
                    calculated from it. It must be 0 or more: to reverse a
                    payment, refund its transaction instead of recording a
                    negative amount.
                customer_id:
                  type: string
                  minLength: 1
                  description: >-
                    Id of the customer who paid (cus_...), as returned when
                    listing customers. The transaction goes to that customer's
                    partner and program, and the customer becomes active.
                billing_type:
                  type: string
                  maxLength: 255
                  description: >-
                    Kind of payment: subscription for a recurring payment, or
                    one_time. Commission flows can match on it.
                charge_id:
                  type: string
                  maxLength: 255
                  description: >-
                    Id of the payment in your billing system, such as a Stripe
                    charge id. A customer can have only one transaction per
                    charge_id, so retrying a create with the same value returns
                    409 instead of booking the payment twice. An empty or
                    whitespace-only charge_id is stored as no charge id and is
                    not checked; any other value is stored and compared exactly
                    as sent.
                click_id:
                  type: string
                  minLength: 1
                  description: >-
                    Id of the tracked click behind this payment, as returned
                    when listing clicks. Commission flows use its link before
                    falling back to the customer's link.
                interval:
                  type: string
                  maxLength: 255
                  description: >-
                    Billing period of a subscription payment: month or year.
                    Commission flows can match on it. Flows can also split a
                    yearly payment into monthly commissions.
                source:
                  type: string
                  maxLength: 255
                  description: >-
                    Where the transaction came from, such as stripe or api.
                    Commissions that flows create from it copy this value.
              required:
                - amount
                - customer_id
              additionalProperties: false
              example:
                customer_id: cus_LBfjvtfct9pVUeLojMHiGnXv
                amount: 5000
                billing_type: subscription
                interval: month
                product_id: prod_pro
                product_name: Pro plan
                source: api
      responses:
        '201':
          description: The created transaction
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Request successful
                  data:
                    $ref: '#/components/schemas/Transaction'
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Successfully created transaction
                data:
                  id: txn_fB3egT1sKNVNu3ZYuU1ypYDA
                  amount: '5000'
                  amount_excluding_tax: null
                  amount_including_tax: null
                  currency: null
                  tax: null
                  payment_amount: null
                  payment_currency: null
                  status: paid
                  source: api
                  billing_type: subscription
                  interval: month
                  quantity: 1
                  partner_id: part_NLYzgNKuSuASvrvoxNtau6SY
                  customer_id: cus_LBfjvtfct9pVUeLojMHiGnXv
                  program_id: prg_T6z8aRW3XCmvFWP972RKxpAd
                  promotion_code_id: null
                  promotion_code_name: null
                  charge_id: null
                  click_id: null
                  product_ids:
                    - prod_pro
                  product_names:
                    - Pro plan
                  conversion_rate: null
                  metadata: null
                  created_at: '2026-10-01T12:00:00Z'
                  updated_at: '2026-10-01T12:00:00Z'
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '400':
          description: Invalid request or customer not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                message: 'request: Invalid input: expected object, received null'
                code: validation_error
                doc_url: https://docs.tolt.com/errors#validation_error
                errors:
                  - field: request
                    message: 'Invalid input: expected object, received null'
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                message: Unauthorized
                code: unauthorized
                doc_url: https://docs.tolt.com/errors#unauthorized
        '409':
          description: The customer already has a transaction with this charge_id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                message: The customer already has a transaction with this charge_id
                code: already_exists
                doc_url: https://docs.tolt.com/errors#already_exists
                errors:
                  - field: charge_id
                    message: The customer already has a transaction with this charge_id
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    Transaction:
      type: object
      properties:
        id:
          type: string
          example: txn_fB3egT1sKNVNu3ZYuU1ypYDA
        amount:
          type:
            - string
            - 'null'
          description: >-
            Integer amount in the smallest currency unit (cents), serialized as
            a string.
          example: '5000'
        amount_excluding_tax:
          type:
            - string
            - 'null'
          description: >-
            Integer amount in the smallest currency unit (cents), serialized as
            a string.
          example: '5000'
        amount_including_tax:
          type:
            - string
            - 'null'
          description: >-
            Integer amount in the smallest currency unit (cents), serialized as
            a string.
          example: '5000'
        currency:
          type:
            - string
            - 'null'
          example: usd
        tax:
          type:
            - number
            - 'null'
          example: 0
        payment_amount:
          type:
            - string
            - 'null'
          description: >-
            Integer amount in the smallest currency unit (cents), serialized as
            a string.
          example: '5000'
        payment_currency:
          type:
            - string
            - 'null'
          example: usd
        status:
          type:
            - string
            - 'null'
          example: paid
        source:
          type:
            - string
            - 'null'
          example: api
        billing_type:
          type:
            - string
            - 'null'
          example: subscription
        interval:
          type:
            - string
            - 'null'
          example: month
        quantity:
          type:
            - number
            - 'null'
          example: 1
        partner_id:
          type:
            - string
            - 'null'
          example: part_NLYzgNKuSuASvrvoxNtau6SY
        customer_id:
          type:
            - string
            - 'null'
          example: cus_LBfjvtfct9pVUeLojMHiGnXv
        program_id:
          type:
            - string
            - 'null'
          example: prg_T6z8aRW3XCmvFWP972RKxpAd
        promotion_code_id:
          type:
            - string
            - 'null'
          example: promo_gTCAUsWfdmN2GuCVRaHWNRan
        promotion_code_name:
          type:
            - string
            - 'null'
          example: SAM20
        charge_id:
          type:
            - string
            - 'null'
          example: ch_R8qW2mN6kP4vT9xY
        click_id:
          type:
            - string
            - 'null'
          example: clk_mEsbFYv6ZjqXjAoFwokjS6v6
        product_ids:
          type:
            - array
            - 'null'
          items:
            type: string
          example:
            - prod_pro
        product_names:
          type:
            - array
            - 'null'
          items:
            type: string
          example:
            - Pro plan
        conversion_rate:
          type:
            - string
            - 'null'
          example: '1'
        metadata:
          example:
            order_id: order_12345
            subscription_id: sub_R8qW2mN6kP4vT9xY
            billing_reason: subscription_create
        created_at:
          type: string
          format: date-time
          example: '2026-10-01T12:00:00Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-10-01T12:00:00Z'
      required:
        - id
        - amount
        - amount_excluding_tax
        - amount_including_tax
        - currency
        - tax
        - payment_amount
        - payment_currency
        - status
        - source
        - billing_type
        - interval
        - quantity
        - partner_id
        - customer_id
        - program_id
        - promotion_code_id
        - promotion_code_name
        - charge_id
        - click_id
        - product_ids
        - product_names
        - conversion_rate
        - created_at
        - updated_at
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          description: Human-readable explanation. May change; branch on code instead.
        code:
          type: string
          enum:
            - bad_request
            - validation_error
            - invalid_reference
            - invalid_cursor
            - unauthorized
            - forbidden
            - not_found
            - conflict
            - already_exists
            - commission_paid
            - commission_frozen
            - transaction_refunded
            - commission_exists
            - rate_limited
            - payload_too_large
            - internal_error
          description: Stable machine-readable error code.
          example: not_found
        doc_url:
          type: string
          example: https://docs.tolt.com/errors#not_found
        errors:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
            required:
              - field
              - message
          description: >-
            One entry per offending field. Present on validation_error and
            invalid_reference.
      required:
        - success
        - message
        - code
        - doc_url
  headers:
    X-RateLimit-Limit:
      description: Requests allowed in the current window.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left in the current window.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: Unix time, in seconds, when the window resets.
      schema:
        type: integer
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  responses:
    PayloadTooLarge:
      description: Request body exceeds 1 MB
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            message: Request body exceeds 1 MB
            code: payload_too_large
            doc_url: https://docs.tolt.com/errors#payload_too_large
    RateLimited:
      description: The API key exceeded its rate limit
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            message: Too many requests. Retry after the window resets.
            code: rate_limited
            doc_url: https://docs.tolt.com/errors#rate_limited
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Tolt API key sent as a bearer token.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.