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

# Create Payment

> **Create Payment**

<Note>
  This endpoint requires authentication. Include your Bearer token in the Authorization header.
</Note>

## Description

**Create Payment**

**Description:**
The `/payment/` endpoint allows creation of payment records with transaction details, currency information, and associated files.

**Method:**
`POST`

**Request Payload:**

| Parameter       | Type   | Description                               |
| --------------- | ------ | ----------------------------------------- |
| user            | string | User ID associated with the payment       |
| title           | string | Title/description of the payment          |
| transactionDate | string | Date and time of the transaction          |
| currency        | string | Currency code (e.g., USD, NGN)            |
| amount          | number | Amount in the specified currency          |
| amountUSD       | number | Amount converted to USD                   |
| conversionRate  | number | Exchange rate used for conversion         |
| memo            | string | Additional notes about the payment        |
| files           | array  | File uploads (multipart/form-data)        |
| id              | string | Optional custom ID for the payment record |

## Code Examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch('https://api.royalti.io/payment/', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      "user": "sample-user",
      "title": "sample-title",
      "transactionDate": "2024-01-21T12:00:00Z",
      "currency": "sample-currency",
      "amount": 1,
      "amountUSD": 1,
      "conversionRate": 1,
      "memo": "sample-memo",
      "files": [
        {}
      ],
      "id": "sample-id"
    })
  });

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
    'https://api.royalti.io/payment/',
    headers={
      'Authorization': f'Bearer {token}'
    },
    json={"user":"sample-user","title":"sample-title","transactionDate":"2024-01-21T12:00:00Z","currency":"sample-currency","amount":1,"amountUSD":1,"conversionRate":1,"memo":"sample-memo","files":[{}],"id":"sample-id"}
  )

  data = response.json()
  print(data)
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.royalti.io/payment/ \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"user":"sample-user","title":"sample-title","transactionDate":"2024-01-21T12:00:00Z","currency":"sample-currency","amount":1,"amountUSD":1,"conversionRate":1,"memo":"sample-memo","files":[{}],"id":"sample-id"}'

  ```
</CodeGroup>


## OpenAPI

````yaml post /payment/
openapi: 3.0.0
info:
  title: Royalti.io API
  description: "# Royalti API\r\n\r\nThis is the Royalti music royalty management platform API server.\r\n\r\n## Overview\r\n\r\nThe Royalti API provides comprehensive music royalty management services including:\r\n- Music publishing and writer management\r\n- Royalty processing and analytics\r\n- DDEX integration for music industry standards\r\n- File processing and pattern recognition\r\n- Payment processing and distribution\r\n\r\n## Authentication\r\n\r\nThe API uses JWT-based authentication with multiple protection levels:\r\n- Public endpoints for basic operations\r\n- Protected endpoints requiring valid JWT tokens\r\n- Admin endpoints for administrative functions\r\n\r\n## Features\r\n\r\n- Multi-dimensional royalty analytics\r\n- CWR (Collective Works Registration) support\r\n- DDEX integration for music metadata\r\n- Advanced file processing with pattern recognition\r\n- Real-time data processing with queue system"
  version: 2.6.0
  contact:
    name: Royalti.io Support
    email: support@royalti.io
    url: https://royalti.io
  license:
    name: Proprietary
    url: https://royalti.io/terms
servers:
  - url: https://api.royalti.io
    description: Production server
  - url: https://api-dev.royalti.io
    description: Development server
  - url: http://localhost:8084
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: Accounting
    description: Accounting and financial transaction operations
  - name: DDEX
    description: DDEX operations (ERN/MEAD, messages, delivery, providers)
  - name: Label
    description: Label management operations
  - name: Internal Webhooks
    description: Internal system webhooks for royalty processing and downloads
  - name: Payment Webhooks
    description: Payment processor webhook endpoints
  - name: Billing Webhooks
    description: Stripe billing and subscription webhooks
  - name: Infrastructure Webhooks
    description: Cloudflare domain and SSL webhooks
  - name: Distribution Webhooks
    description: Digital distribution platform webhooks (FUGA)
paths:
  /payment/:
    post:
      tags:
        - Payment
      summary: Create Payment
      description: >-
        **Create Payment**


        **Description:**

        The `/payment/` endpoint allows creation of payment records with
        transaction details, currency information, and associated files.


        **Method:**

        `POST`


        **Request Payload:**


        | Parameter | Type | Description |

        | --- | --- | --- |

        | user | string | User ID associated with the payment |

        | title | string | Title/description of the payment |

        | transactionDate | string | Date and time of the transaction |

        | currency | string | Currency code (e.g., USD, NGN) |

        | amount | number | Amount in the specified currency |

        | amountUSD | number | Amount converted to USD |

        | conversionRate | number | Exchange rate used for conversion |

        | memo | string | Additional notes about the payment |

        | files | array | File uploads (multipart/form-data) |

        | id | string | Optional custom ID for the payment record |
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                user:
                  type: string
                  description: TenantUserId associated with the payment
                title:
                  type: string
                  description: Title/description of the payment
                transactionDate:
                  type: string
                  format: date-time
                  description: Date and time of the transaction
                currency:
                  type: string
                  description: Currency code (e.g., USD, NGN)
                amount:
                  type: number
                  description: Amount in the specified currency
                amountUSD:
                  type: number
                  description: Amount converted to USD
                conversionRate:
                  type: number
                  description: Exchange rate used for conversion
                memo:
                  type: string
                  description: Additional notes about the payment
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                  description: File attachments (receipts, invoices, etc.)
                id:
                  type: string
                  description: Optional custom ID for the payment record
              required:
                - user
                - title
                - transactionDate
                - currency
                - amount
                - amountUSD
          application/json:
            schema:
              type: object
              properties:
                user:
                  type: string
                  description: TenantUserId associated with the payment
                title:
                  type: string
                  description: Title/description of the payment
                transactionDate:
                  type: string
                  format: date-time
                  description: Date and time of the transaction
                currency:
                  type: string
                  description: Currency code (e.g., USD, NGN)
                amount:
                  type: number
                  description: Amount in the specified currency
                amountUSD:
                  type: number
                  description: Amount converted to USD
                conversionRate:
                  type: number
                  description: Exchange rate used for conversion
                memo:
                  type: string
                  description: Additional notes about the payment
                files:
                  type: array
                  items:
                    type: string
                  description: Array of file names associated with the payment
                id:
                  type: string
                  description: Optional custom ID for the payment record
              required:
                - user
                - title
                - transactionDate
                - currency
                - amount
                - amountUSD
              example:
                user: 8560f85a-2416-47d7-a908-5cd2a6c51659
                title: Payment Receipt test
                transactionDate: '2023-04-21T12:00:00Z'
                currency: USD
                amount: 74000
                amountUSD: 100
                conversionRate: 740
                memo: Sale of album
                files:
                  - file1.pdf
                  - file2.pdf
                id: 8560f85a-2416-47d7-a908-5cd2a6c51659
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  TenantId:
                    type: integer
                  TenantUserId:
                    type: string
                  title:
                    type: string
                  transactionDate:
                    type: string
                    format: date
                  currency:
                    type: string
                  amount:
                    type: number
                  amountUSD:
                    type: number
                  conversionRate:
                    type: number
                  memo:
                    type: string
                  updatedAt:
                    type: string
                    format: date-time
                  createdAt:
                    type: string
                    format: date-time
              example:
                id: a6afa463-1073-4e14-860e-f5bbd9da0f74
                TenantId: 1
                TenantUserId: 8560f85a-2416-47d7-a908-5cd2a6c51659
                title: Payment Receipt test
                transactionDate: '2023-04-21'
                currency: USD
                amount: 74000
                amountUSD: 100
                conversionRate: 740
                memo: Sale of album
                updatedAt: '2023-06-14T08:04:36.374Z'
                createdAt: '2023-06-14T08:04:36.374Z'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: array
              items:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Format: "Bearer
        {token}"

````