> ## 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 New Payment Setting

> **`/payment-setting/`**

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

## Description

**`/payment-setting/`**

This endpoint is responsible for creating a new payment setting.

**Method:**\
`POST`

**Request Payload:**

| Field     | Type    | Required | Description                                                                                                                                                                                                                           |
| --------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name      | string  | Yes      | The name of the payment setting                                                                                                                                                                                                       |
| type      | string  | Yes      | The type of the payment setting                                                                                                                                                                                                       |
| settings  | object  | Yes      | The settings/configuration of the payment setting. Some of the sample properties are "accountName", "accountNumber", "bankName", "routingNumber", "swiftCode", "IBAN", indicating details related to the payment method configuration |
| isDefault | boolean | No       | Indicates whether the payment setting is the default one                                                                                                                                                                              |
| memo      | string  | No       | Any additional notes or comments about the payment setting                                                                                                                                                                            |
| user      | string  | No       | TenantUserId of the user, used when setting up payment settings for other users (admin/owner only)                                                                                                                                    |

#### Request Body Examples

**Bank Wire Transfer:**

```json theme={null}
{
  "name": "Primary Bank Account",
  "type": "BankWireTransfer",
  "settings": {
    "bankName": "Bank of Example",
    "accountNumber": "123456789",
    "bankCode": "987654",
    "country": "USA",
    "countryCode": "US",
    "currency": "USD"
  },
  "isDefault": true,
  "memo": "Main operational account"
}
```

**PayPal:**

```json theme={null}
{
  "name": "Primary PayPal Account",
  "type": "PayPal",
  "settings": {
    "paypalEmail": "example@paypal.com",
    "country": "USA",
    "countryCode": "US",
    "currency": "USD"
  },
  "isDefault": true,
  "memo": "Main PayPal account"
}
```

## Code Examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch('https://api.royalti.io/payment-setting', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      "name": "sample-name",
      "type": "sample-type",
      "settings": {},
      "isDefault": true,
      "user": "sample-user",
      "memo": "sample-memo"
    })
  });

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

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

  response = requests.post(
    'https://api.royalti.io/payment-setting',
    headers={
      'Authorization': f'Bearer {token}'
    },
    json={"name":"sample-name","type":"sample-type","settings":{},"isDefault":true,"user":"sample-user","memo":"sample-memo"}
  )

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

  ```bash cURL theme={null}
  curl -X POST https://api.royalti.io/payment-setting \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"name":"sample-name","type":"sample-type","settings":{},"isDefault":true,"user":"sample-user","memo":"sample-memo"}'

  ```
</CodeGroup>


## OpenAPI

````yaml post /payment-setting
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-setting:
    post:
      tags:
        - Payment Settings
      summary: Create New Payment Setting
      description: >-
        **`/payment-setting/`**


        This endpoint is responsible for creating a new payment setting.


        **Method:**  

        `POST`


        **Request Payload:**


        | Field | Type | Required | Description |

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

        | name | string | Yes | The name of the payment setting |

        | type | string | Yes | The type of the payment setting |

        | settings | object | Yes | The settings/configuration of the payment
        setting. Some of the sample properties are "accountName",
        "accountNumber", "bankName", "routingNumber", "swiftCode", "IBAN",
        indicating details related to the payment method configuration |

        | isDefault | boolean | No | Indicates whether the payment setting is
        the default one |

        | memo | string | No | Any additional notes or comments about the
        payment setting |

        | user | string | No | TenantUserId of the user, used when setting up
        payment settings for other users (admin/owner only) |


        #### Request Body Examples


        **Bank Wire Transfer:**


        ``` json

        {
          "name": "Primary Bank Account",
          "type": "BankWireTransfer",
          "settings": {
            "bankName": "Bank of Example",
            "accountNumber": "123456789",
            "bankCode": "987654",
            "country": "USA",
            "countryCode": "US",
            "currency": "USD"
          },
          "isDefault": true,
          "memo": "Main operational account"
        }

        ```


        **PayPal:**


        ``` json

        {
          "name": "Primary PayPal Account",
          "type": "PayPal",
          "settings": {
            "paypalEmail": "example@paypal.com",
            "country": "USA",
            "countryCode": "US",
            "currency": "USD"
          },
          "isDefault": true,
          "memo": "Main PayPal account"
        }

        ```
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: The name of the payment setting
                type:
                  type: string
                  description: The type of the payment setting
                  enum:
                    - BankWireTransfer
                    - PayPal
                    - Card
                    - Crypto
                settings:
                  type: object
                  description: The settings/configuration of the payment setting
                isDefault:
                  type: boolean
                  description: Indicates whether the payment setting is the default one
                  default: false
                user:
                  type: string
                  description: >-
                    UserId of the user who created the payment setting, used
                    when setting up payments settings for other used
                memo:
                  type: string
                  description: Any additional notes or comments about the payment setting
              required:
                - name
                - type
                - settings
            examples:
              bankWireTransfer:
                summary: Bank Wire Transfer Example
                value:
                  name: Primary Bank Account
                  type: BankWireTransfer
                  settings:
                    bankName: Bank of Example
                    accountNumber: '123456789'
                    bankCode: '987654'
                    country: USA
                    countryCode: US
                    currency: USD
                  isDefault: true
                  memo: Main operational account
                  user: ''
              paypal:
                summary: PayPal Example
                value:
                  name: Primary PayPal Account
                  type: PayPal
                  settings:
                    paypalEmail: example@paypal.com
                    country: USA
                    countryCode: US
                    currency: USD
                  isDefault: true
                  memo: Main PayPal account
                  user: ''
      responses:
        '201':
          description: Payment setting created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  message:
                    type: string
                  paymentSetting:
                    $ref: '#/components/schemas/PaymentSetting'
              example:
                status: success
                message: Payment setting created successfully
                paymentSetting:
                  id: 24d2c371-4a7a-4acd-b4aa-d3eb3bebd8fa
                  name: Primary Bank Account
                  type: BankWireTransfer
                  settings:
                    bankName: Bank of Example
                    accountNumber: '123456789'
                    bankCode: '987654'
                    country: USA
                    countryCode: US
                    currency: USD
                  isDefault: true
                  memo: Main operational account
                  createdAt: '2023-11-22T20:48:36.034Z'
                  updatedAt: '2023-11-22T20:48:36.034Z'
        '400':
          description: Bad Request - Invalid data
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  errors:
                    type: array
                    items:
                      type: string
              example:
                message: Validation failed
                errors:
                  - Name is required
                  - Invalid payment type
        '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:
    PaymentSetting:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier of the payment setting
        name:
          type: string
          description: The name of the payment setting
        type:
          type: string
          description: The type of the payment setting
          enum:
            - BankWireTransfer
            - PayPal
        settings:
          type: object
          description: The settings/configuration of the payment setting
          oneOf:
            - title: Bank Wire Transfer Settings
              properties:
                bankName:
                  type: string
                  description: Name of the bank
                accountNumber:
                  type: string
                  description: Bank account number
                bankCode:
                  type: string
                  description: Bank code or routing number
                country:
                  type: string
                  description: Country of the bank
                countryCode:
                  type: string
                  description: Country code
                currency:
                  type: string
                  description: Currency code
                routingNumber:
                  type: string
                  description: Routing number
                swiftCode:
                  type: string
                  description: SWIFT code for international transfers
                IBAN:
                  type: string
                  description: International Bank Account Number
            - title: PayPal Settings
              properties:
                paypalEmail:
                  type: string
                  format: email
                  description: PayPal email address
                country:
                  type: string
                  description: Country
                countryCode:
                  type: string
                  description: Country code
                currency:
                  type: string
                  description: Currency code
        isDefault:
          type: boolean
          description: Indicates whether the payment setting is the default one
        memo:
          type: string
          description: Any additional notes or comments about the payment setting
        TenantId:
          type: integer
          description: The tenant identifier
        TenantUserId:
          type: string
          format: uuid
          description: The tenant user identifier who created the setting
        createdAt:
          type: string
          format: date-time
          description: When the payment setting was created
        updatedAt:
          type: string
          format: date-time
          description: When the payment setting was last updated
    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}"

````