openapi: 3.1.0
info:
  title: SELVA Core API
  version: 0.0.1
  description: |-
    Customer-facing SELVA Core API documentation.

    Authenticated endpoints use Passport bearer tokens. Internal KINDO callback routes are intentionally excluded.
servers:
  - url: https://staging.selva.fi.cr
  - url: https://app.selva.fi.cr
paths:
  /api/user:
    get:
      operationId: user.show
      tags:
        - User
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: User retrieved successfully
                  data:
                    $ref: '#/components/schemas/UserResource'
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: User retrieved successfully
                data:
                  id: 19acabe8-ce4d-4fc8-9279-6eedf39995e6
                  name: Alice Johnson
                  email: alice.johnson@example.com
                  email_verified_at: null
                  created_at: '2026-04-01T00:00:00.000000Z'
                  updated_at: '2026-04-01T00:10:00.000000Z'
        '401':
          $ref: '#/components/responses/AuthenticationException'
      summary: Get User
      security:
        - BearerAuth: []
  /api/payments:
    post:
      operationId: payment.sendPayment
      summary: Send Payment
      tags:
        - Payments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendPaymentRequest'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Payment initiated successfully
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      channel:
                        type: string
                        enum:
                          - pin
                          - sinpe_movil
                      status:
                        type: string
                        enum:
                          - pending
                          - processing
                          - completed
                          - failed
                          - timeout
                          - service_unavailable
                          - validation_failed
                          - system_error
                      channel_reference:
                        type: string
                    required:
                      - id
                      - channel
                      - status
                      - channel_reference
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Payment initiated successfully
                data:
                  id: 7b200345-c922-476e-bbc4-e2a143165ca6
                  channel: pin
                  status: pending
                  channel_reference: '2026041300001400641289793'
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Payment processing failed
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      security:
        - BearerAuth: []
  /api/payments/validate:
    post:
      operationId: payment.validatePayment
      summary: Validate Payment
      tags:
        - Payments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendPaymentRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Payment data is valid
                  data:
                    type: object
                    properties:
                      channel:
                        type: string
                      fee:
                        type: object
                        properties:
                          value:
                            type: integer
                            description: Amount in minor units of the currency. For example, 1000 is equivalent to 10.00.
                            example: 100
                          currency:
                            type: string
                            example: CRC
                          formatted:
                            type: string
                            example: 1.00 CRC
                        required:
                          - value
                          - currency
                          - formatted
                    required:
                      - channel
                      - fee
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Payment data is valid
                data:
                  channel: pin
                  fee:
                    value: 100
                    currency: CRC
                    formatted: 1.00 CRC
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '409':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '422':
          $ref: '#/components/responses/ValidationException'
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Payment validation failed
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      description: Validates payment details without initiating the transaction. Returns validation status and any errors.
      security:
        - BearerAuth: []
  /api/payments/{id}:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    get:
      operationId: payment.getPaymentStatus
      summary: Get Payment Details
      tags:
        - Payments
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Payment status retrieved successfully
                  data:
                    $ref: '#/components/schemas/PaymentResource'
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Payment status retrieved successfully
                data:
                  id: 4aebf342-8e69-4712-8cbc-77326bf19660
                  idempotency_key: f80fa916-f435-4003-a772-81b03d5c4162
                  cgp_ref_number: 10739
                  channel_reference: '2026041200001915461001586'
                  sinpe_reference: '2026041237022010000107394'
                  transfer_type: debit
                  status: completed
                  amount:
                    value: 10000
                    currency: CRC
                    formatted: 100.00 CRC
                  fee:
                    value: 100
                    currency: CRC
                    formatted: 1.00 CRC
                  payer:
                    iban: CR41037010700577264928
                    document_number: '3918734189'
                    document_type: 3
                    name: Alice Johnson
                  payee:
                    document_number: '0304930258'
                    document_type: 0
                    name: Bob Smith
                    iban: CR27010400128230020117
                  description: null
                  reference: null
                  error_message: null
                  created_at: '2026-04-01T00:00:00.000000Z'
                  submitted_at: '2026-04-01T00:01:00.000000Z'
                  completed_at: '2026-04-01T00:02:00.000000Z'
                  channel: pin
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '422':
          $ref: '#/components/responses/ValidationException'
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Unable to retrieve payment details
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      security:
        - BearerAuth: []
  /api/payments/history:
    get:
      operationId: payment.getPaymentHistory
      summary: Get Historical Transfers
      tags:
        - Payments
      parameters:
        - name: per_page
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 1000
        - name: page
          in: query
          schema:
            type: integer
            minimum: 1
        - name: channel
          in: query
          schema:
            type:
              - string
              - 'null'
            enum:
              - pin
              - sinpe_movil
        - name: transfer_type
          in: query
          schema:
            type:
              - string
              - 'null'
            enum:
              - debit
              - credit
        - name: recipient_document_number
          in: query
          schema:
            anyOf:
              - $ref: '#/components/schemas/DocumentIdentifier'
              - type: 'null'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Payment history retrieved successfully
                  data:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        minimum: 1
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/PaymentResource'
                      first_page_url:
                        type:
                          - string
                          - 'null'
                      from:
                        type:
                          - integer
                          - 'null'
                        minimum: 1
                      last_page:
                        type: integer
                        minimum: 1
                      last_page_url:
                        type:
                          - string
                          - 'null'
                      links:
                        type: array
                        description: Generated paginator links.
                        items:
                          type: object
                          properties:
                            url:
                              type:
                                - string
                                - 'null'
                            label:
                              type: string
                            page:
                              type:
                                - integer
                                - 'null'
                              minimum: 1
                            active:
                              type: boolean
                          required:
                            - url
                            - label
                            - page
                            - active
                      next_page_url:
                        type:
                          - string
                          - 'null'
                      path:
                        type:
                          - string
                          - 'null'
                        description: Base path for paginator generated URLs.
                      per_page:
                        type: integer
                        description: Number of items shown per page.
                        minimum: 0
                      prev_page_url:
                        type:
                          - string
                          - 'null'
                      to:
                        type:
                          - integer
                          - 'null'
                        description: Number of the last item in the slice.
                        minimum: 1
                      total:
                        type: integer
                        description: Total number of items being paginated.
                        minimum: 0
                    required:
                      - current_page
                      - data
                      - first_page_url
                      - from
                      - last_page
                      - last_page_url
                      - links
                      - next_page_url
                      - path
                      - per_page
                      - prev_page_url
                      - to
                      - total
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Payment history retrieved successfully
                data:
                  current_page: 1
                  data:
                    - id: 4aebf342-8e69-4712-8cbc-77326bf19660
                      idempotency_key: f80fa916-f435-4003-a772-81b03d5c4162
                      cgp_ref_number: 10739
                      channel_reference: '2026041200001915461001586'
                      sinpe_reference: '2026041237022010000107394'
                      transfer_type: debit
                      status: completed
                      amount:
                        value: 10000
                        currency: CRC
                        formatted: 100.00 CRC
                      fee:
                        value: 100
                        currency: CRC
                        formatted: 1.00 CRC
                      payer:
                        iban: CR41037010700577264928
                        document_number: '3918734189'
                        document_type: 3
                        name: Alice Johnson
                      payee:
                        document_number: '0304930258'
                        document_type: 0
                        name: Bob Smith
                        iban: CR27010400128230020117
                      description: null
                      reference: null
                      error_message: null
                      created_at: '2026-04-01T00:00:00.000000Z'
                      submitted_at: '2026-04-01T00:01:00.000000Z'
                      completed_at: '2026-04-01T00:02:00.000000Z'
                      channel: pin
                    - id: 80c530a1-4f79-485d-bc0d-5c560d8ff300
                      idempotency_key: 6f19de2e-f9f0-4d4b-86cd-819bcfc024f2
                      cgp_ref_number: 10680
                      channel_reference: '2026040700001211177562391'
                      sinpe_reference: '2026040737022010000106803'
                      transfer_type: debit
                      status: completed
                      amount:
                        value: 9900
                        currency: CRC
                        formatted: 99.00 CRC
                      fee: null
                      payer:
                        iban: CR19037010600733756399
                        document_number: '3918734189'
                        document_type: 3
                        name: Alice Johnson
                      payee:
                        document_number: '0303870686'
                        document_type: 0
                        name: Bob Smith
                        iban: CR09010200009097516385
                      description: null
                      reference: null
                      error_message: null
                      created_at: '2026-04-01T00:03:00.000000Z'
                      submitted_at: '2026-04-01T00:04:00.000000Z'
                      completed_at: '2026-04-01T00:05:00.000000Z'
                      channel: pin
                  first_page_url: https://staging.selva.fi.cr/api/payments/history?page=1
                  from: 1
                  last_page: 8
                  last_page_url: https://staging.selva.fi.cr/api/payments/history?page=8
                  links:
                    - url: null
                      label: '&laquo; Anterior'
                      page: null
                      active: false
                    - url: https://staging.selva.fi.cr/api/payments/history?page=1
                      label: '1'
                      page: 1
                      active: true
                    - url: https://staging.selva.fi.cr/api/payments/history?page=2
                      label: '2'
                      page: 2
                      active: false
                    - url: https://staging.selva.fi.cr/api/payments/history?page=3
                      label: '3'
                      page: 3
                      active: false
                    - url: https://staging.selva.fi.cr/api/payments/history?page=4
                      label: '4'
                      page: 4
                      active: false
                    - url: https://staging.selva.fi.cr/api/payments/history?page=5
                      label: '5'
                      page: 5
                      active: false
                    - url: https://staging.selva.fi.cr/api/payments/history?page=6
                      label: '6'
                      page: 6
                      active: false
                    - url: https://staging.selva.fi.cr/api/payments/history?page=7
                      label: '7'
                      page: 7
                      active: false
                    - url: https://staging.selva.fi.cr/api/payments/history?page=8
                      label: '8'
                      page: 8
                      active: false
                    - url: https://staging.selva.fi.cr/api/payments/history?page=2
                      label: Siguiente &raquo;
                      page: 2
                      active: false
                  next_page_url: https://staging.selva.fi.cr/api/payments/history?page=2
                  path: https://staging.selva.fi.cr/api/payments/history
                  per_page: 2
                  prev_page_url: null
                  to: 2
                  total: 16
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
      security:
        - BearerAuth: []
  /api/payments/service-status:
    get:
      operationId: payment.getServiceStatus
      summary: Get Service Status
      tags:
        - Payments
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Service status retrieved successfully
                  data:
                    type: object
                    properties:
                      pin_service:
                        type: object
                        properties:
                          available:
                            type: boolean
                          status:
                            type: string
                            enum:
                              - online
                              - offline
                        required:
                          - available
                          - status
                      sinpe_service:
                        type: object
                        properties:
                          available:
                            type: boolean
                          status:
                            type: string
                            enum:
                              - online
                              - offline
                        required:
                          - available
                          - status
                      overall_status:
                        type: string
                        enum:
                          - online
                          - partial
                          - offline
                    required:
                      - pin_service
                      - sinpe_service
                      - overall_status
                required:
                  - success
                  - message
                  - data
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Unable to check service status
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      security: []
  /api/accounts/{id}:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    get:
      operationId: account.show
      tags:
        - Account
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Account retrieved successfully
                  data:
                    $ref: '#/components/schemas/AccountDetailsResource'
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Account retrieved successfully
                data:
                  id: 45a03920-6826-48cc-8141-46995bdbd201
                  document_number: '3918734189'
                  document_type: 3
                  iban: CR09037010700634070547
                  balance:
                    value: 10000000
                    currency: CRC
                    formatted: 100,000.00 CRC
                  owner_name: Alice Johnson
                  status: active
                  created_at: '2026-04-01T00:00:00.000000Z'
                  updated_at: '2026-04-01T00:10:00.000000Z'
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Account not found
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '422':
          $ref: '#/components/responses/ValidationException'
        '503':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Unable to retrieve account balance
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      summary: Get Account
      security:
        - BearerAuth: []
  /api/accounts:
    get:
      operationId: account.index
      tags:
        - Account
      parameters:
        - name: per_page
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 1000
        - name: page
          in: query
          schema:
            type: integer
            minimum: 1
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Accounts retrieved successfully
                  data:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        minimum: 1
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/AccountDetailsResource'
                      first_page_url:
                        type:
                          - string
                          - 'null'
                      from:
                        type:
                          - integer
                          - 'null'
                        minimum: 1
                      last_page:
                        type: integer
                        minimum: 1
                      last_page_url:
                        type:
                          - string
                          - 'null'
                      links:
                        type: array
                        description: Generated paginator links.
                        items:
                          type: object
                          properties:
                            url:
                              type:
                                - string
                                - 'null'
                            label:
                              type: string
                            page:
                              type:
                                - integer
                                - 'null'
                              minimum: 1
                            active:
                              type: boolean
                          required:
                            - url
                            - label
                            - page
                            - active
                      next_page_url:
                        type:
                          - string
                          - 'null'
                      path:
                        type:
                          - string
                          - 'null'
                        description: Base path for paginator generated URLs.
                      per_page:
                        type: integer
                        description: Number of items shown per page.
                        minimum: 0
                      prev_page_url:
                        type:
                          - string
                          - 'null'
                      to:
                        type:
                          - integer
                          - 'null'
                        description: Number of the last item in the slice.
                        minimum: 1
                      total:
                        type: integer
                        description: Total number of items being paginated.
                        minimum: 0
                    required:
                      - current_page
                      - data
                      - first_page_url
                      - from
                      - last_page
                      - last_page_url
                      - links
                      - next_page_url
                      - path
                      - per_page
                      - prev_page_url
                      - to
                      - total
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Accounts retrieved successfully
                data:
                  current_page: 1
                  data:
                    - id: 45a03920-6826-48cc-8141-46995bdbd201
                      document_number: '3918734189'
                      document_type: 3
                      iban: CR09037010700634070547
                      balance:
                        value: 0
                        currency: CRC
                        formatted: 0.00 CRC
                      owner_name: Alice Johnson
                      status: active
                      created_at: '2026-04-01T00:00:00.000000Z'
                      updated_at: '2026-04-01T00:10:00.000000Z'
                    - id: 6077687b-d558-4b19-8a7d-9d908cdc0e94
                      document_number: '3918734189'
                      document_type: 3
                      iban: CR66037020700582638942
                      balance:
                        value: 300
                        currency: USD
                        formatted: 3.00 USD
                      owner_name: Alice Johnson
                      status: active
                      created_at: '2026-04-01T00:20:00.000000Z'
                      updated_at: '2026-04-01T00:20:00.000000Z'
                    - id: 2532b0df-c614-42b6-8a4f-d9d866e6aedd
                      document_number: '3918734189'
                      document_type: 3
                      iban: CR41037010700577264928
                      balance:
                        value: 41408900
                        currency: CRC
                        formatted: 414,089.00 CRC
                      owner_name: Alice Johnson
                      status: active
                      created_at: '2026-04-01T00:30:00.000000Z'
                      updated_at: '2026-04-01T00:30:00.000000Z'
                    - id: c7684804-f667-4007-a9e8-8b3d385aac66
                      document_number: '3918734189'
                      document_type: 3
                      iban: CR79037020600884970835
                      balance:
                        value: 6100
                        currency: USD
                        formatted: 61.00 USD
                      owner_name: Alice Johnson
                      status: active
                      created_at: '2026-04-01T00:40:00.000000Z'
                      updated_at: '2026-04-01T00:40:00.000000Z'
                    - id: c91bafa8-6d0e-4493-aa59-58ba9d6f67d4
                      document_number: '3918734189'
                      document_type: 3
                      iban: CR19037010600733756399
                      balance:
                        value: 519815
                        currency: CRC
                        formatted: 5,198.15 CRC
                      owner_name: Alice Johnson
                      status: active
                      created_at: '2026-04-01T00:50:00.000000Z'
                      updated_at: '2026-04-01T00:50:00.000000Z'
                  first_page_url: https://staging.selva.fi.cr/api/accounts?page=1
                  from: 1
                  last_page: 1
                  last_page_url: https://staging.selva.fi.cr/api/accounts?page=1
                  links:
                    - url: null
                      label: '&laquo; Anterior'
                      page: null
                      active: false
                    - url: https://staging.selva.fi.cr/api/accounts?page=1
                      label: '1'
                      page: 1
                      active: true
                    - url: null
                      label: Siguiente &raquo;
                      page: null
                      active: false
                  next_page_url: null
                  path: https://staging.selva.fi.cr/api/accounts
                  per_page: 15
                  prev_page_url: null
                  to: 5
                  total: 5
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '503':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Unable to retrieve account balance
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      summary: List Accounts
      security:
        - BearerAuth: []
    post:
      operationId: account.store
      tags:
        - Account
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAccountRequest'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Account created successfully
                  data:
                    $ref: '#/components/schemas/AccountResource'
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Account created successfully
                data:
                  id: 45a03920-6826-48cc-8141-46995bdbd201
                  iban: CR09037010700634070547
                  currency: CRC
                  created_at: '2026-04-01T00:00:00.000000Z'
                  updated_at: '2026-04-01T00:10:00.000000Z'
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '422':
          $ref: '#/components/responses/ValidationException'
      summary: Create Account
      security:
        - BearerAuth: []
  /api/accounts/{id}/balance:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    get:
      operationId: account.balance
      tags:
        - Account
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Balance retrieved successfully
                  data:
                    $ref: '#/components/schemas/AccountWithBalanceResource'
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Balance retrieved successfully
                data:
                  iban: CR19037010600733756399
                  currency: CRC
                  balance: 519815
                  formatted: 5,198.15 CRC
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Account not found
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '422':
          $ref: '#/components/responses/ValidationException'
        '503':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Unable to retrieve account balance
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      summary: Get Account Balance
      security:
        - BearerAuth: []
  /api/phone/information/{phone}:
    get:
      operationId: phone.getPhoneInformation
      summary: Verify Phone Is Registered
      tags:
        - Verification
      parameters:
        - name: phone
          in: path
          required: true
          schema:
            type: string
            pattern: ^(506)?[2678]\d{7}$
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Phone information retrieved successfully
                  data:
                    type: object
                    properties:
                      phone_number:
                        type: string
                      name:
                        type: string
                      document_number:
                        type: string
                      document_type:
                        type: 'null'
                      currency:
                        type: string
                      country_code:
                        type: string
                      entity_name:
                        type: string
                      status:
                        $ref: '#/components/schemas/PhoneVerificationStatus'
                    required:
                      - phone_number
                      - name
                      - document_number
                      - document_type
                      - currency
                      - country_code
                      - entity_name
                      - status
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Phone information retrieved successfully
                data:
                  phone_number: '88880001'
                  name: Alice Johnson
                  document_number: '0308880719'
                  document_type: null
                  currency: CRC
                  country_code: CR
                  entity_name: SOLUCIONES ELECTRÓNICAS LOCALES DE VALOR SRL
                  status: registered
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Phone number not found in SINPE registry
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '422':
          $ref: '#/components/responses/ValidationException'
      security:
        - BearerAuth: []
  /api/iban/information/{iban}:
    get:
      operationId: iban.getIbanInformation
      summary: Verify IBAN Is Registered
      tags:
        - Verification
      parameters:
        - name: iban
          in: path
          required: true
          schema:
            type: string
            pattern: ^CR\d{20}$
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: IBAN information retrieved successfully
                  data:
                    type: object
                    properties:
                      iban:
                        type: string
                      name:
                        type: string
                      document_number:
                        type: string
                      document_type:
                        type: integer
                      currency:
                        type: string
                      country_code:
                        type: string
                      entity_name:
                        type: string
                      status:
                        $ref: '#/components/schemas/IBANStatus'
                    required:
                      - iban
                      - name
                      - document_number
                      - document_type
                      - currency
                      - country_code
                      - entity_name
                      - status
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: IBAN information retrieved successfully
                data:
                  iban: CR36012080001000000027
                  name: Alice Johnson
                  document_number: '0113890566'
                  document_type: 0
                  currency: CRC
                  country_code: CR
                  entity_name: SOLUCIONES ELECTRÓNICAS LOCALES DE VALOR SRL
                  status: active
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: IBAN not found
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '422':
          $ref: '#/components/responses/ValidationException'
      security:
        - BearerAuth: []
  /api/webhooks/subscriptions/{id}:
    get:
      operationId: webhookSubscription.show
      summary: Get Webhook
      tags:
        - Webhook
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription retrieved successfully
                  data:
                    $ref: '#/components/schemas/WebhookSubscription'
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Webhook subscription retrieved successfully
                data:
                  id: a20239e2-f4d6-4a93-9fa1-7dd0534e028e
                  url: https://webhook.example.com/selva-events
                  events:
                    - payment.created
                    - payment.processing
                    - payment.completed
                    - payment.failed
                    - transaction.received
                  active: true
                  max_attempts: 10
                  timeout: 30
                  headers:
                    X-Custom-Header: value
                  last_sent_at: null
                  created_at: '2026-04-01T00:00:00.000000Z'
                  updated_at: '2026-04-01T00:10:00.000000Z'
                  suspended_at: null
                  suspended_reason: null
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription not found
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '422':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Validation failed
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      security:
        - BearerAuth: []
    delete:
      operationId: webhookSubscription.destroy
      summary: Delete Webhook
      tags:
        - Webhook
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription deleted successfully
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      url:
                        type: string
                      events:
                        type: array
                        items:
                          type: string
                      max_attempts:
                        type: integer
                      timeout:
                        type: integer
                      headers:
                        type:
                          - object
                          - 'null'
                        additionalProperties:
                          type: string
                      created_at:
                        type: string
                      updated_at:
                        type: string
                    required:
                      - id
                      - url
                      - events
                      - max_attempts
                      - timeout
                      - headers
                      - created_at
                      - updated_at
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Webhook subscription deleted successfully
                data:
                  id: a20239e2-f4d6-4a93-9fa1-7dd0534e028e
                  url: https://webhook.example.com/selva-events
                  events:
                    - payment.created
                    - payment.processing
                    - payment.completed
                    - payment.failed
                    - transaction.received
                  max_attempts: 10
                  timeout: 30
                  headers:
                    X-Custom-Header: value
                  created_at: '2026-04-01T00:00:00.000000Z'
                  updated_at: '2026-04-01T00:10:00.000000Z'
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription not found
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '422':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Validation failed
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Failed to delete webhook subscription
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      security:
        - BearerAuth: []
  /api/webhooks/subscriptions:
    get:
      operationId: webhookSubscription.index
      summary: List Webhooks
      tags:
        - Webhook
      parameters:
        - name: per_page
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 1000
        - name: page
          in: query
          schema:
            type: integer
            minimum: 1
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscriptions retrieved successfully
                  data:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        minimum: 1
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/WebhookSubscription'
                      first_page_url:
                        type:
                          - string
                          - 'null'
                      from:
                        type:
                          - integer
                          - 'null'
                        minimum: 1
                      last_page_url:
                        type:
                          - string
                          - 'null'
                      last_page:
                        type: integer
                        minimum: 1
                      links:
                        type: array
                        description: Generated paginator links.
                        items:
                          type: object
                          properties:
                            url:
                              type:
                                - string
                                - 'null'
                            label:
                              type: string
                            page:
                              type:
                                - integer
                                - 'null'
                              minimum: 1
                            active:
                              type: boolean
                          required:
                            - url
                            - label
                            - page
                            - active
                      next_page_url:
                        type:
                          - string
                          - 'null'
                      path:
                        type:
                          - string
                          - 'null'
                        description: Base path for paginator generated URLs.
                      per_page:
                        type: integer
                        description: Number of items shown per page.
                        minimum: 0
                      prev_page_url:
                        type:
                          - string
                          - 'null'
                      to:
                        type:
                          - integer
                          - 'null'
                        description: Number of the last item in the slice.
                        minimum: 1
                      total:
                        type: integer
                        description: Total number of items being paginated.
                        minimum: 0
                    required:
                      - current_page
                      - data
                      - first_page_url
                      - from
                      - last_page_url
                      - last_page
                      - links
                      - next_page_url
                      - path
                      - per_page
                      - prev_page_url
                      - to
                      - total
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Webhook subscriptions retrieved successfully
                data:
                  current_page: 1
                  data:
                    - id: a20239e2-f4d6-4a93-9fa1-7dd0534e028e
                      url: https://webhook.example.com/selva-events
                      events:
                        - payment.created
                        - payment.processing
                        - payment.completed
                        - payment.failed
                        - transaction.received
                      active: true
                      max_attempts: 10
                      timeout: 30
                      headers:
                        X-Custom-Header: value
                      last_sent_at: null
                      created_at: '2026-04-01T00:00:00.000000Z'
                      updated_at: '2026-04-01T00:10:00.000000Z'
                      suspended_at: null
                      suspended_reason: null
                  first_page_url: https://staging.selva.fi.cr/api/webhooks/subscriptions?page=1
                  from: 1
                  last_page: 1
                  last_page_url: https://staging.selva.fi.cr/api/webhooks/subscriptions?page=1
                  links:
                    - url: null
                      label: '&laquo; Anterior'
                      page: null
                      active: false
                    - url: https://staging.selva.fi.cr/api/webhooks/subscriptions?page=1
                      label: '1'
                      page: 1
                      active: true
                    - url: null
                      label: Siguiente &raquo;
                      page: null
                      active: false
                  next_page_url: null
                  path: https://staging.selva.fi.cr/api/webhooks/subscriptions
                  per_page: 15
                  prev_page_url: null
                  to: 1
                  total: 1
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
      security:
        - BearerAuth: []
    post:
      operationId: webhookSubscription.store
      summary: Create Webhook
      tags:
        - Webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreWebhookSubscriptionRequest'
            example:
              url: https://webhook.example.com/selva-events
              events:
                - payment.created
                - payment.processing
                - payment.completed
                - payment.failed
                - transaction.received
              max_attempts: 10
              timeout: 30
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription created successfully
                  data:
                    $ref: '#/components/schemas/CreatedWebhookSubscription'
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Webhook subscription created successfully
                data:
                  url: https://webhook.example.com/selva-events
                  events:
                    - payment.created
                    - payment.processing
                    - payment.completed
                    - payment.failed
                    - transaction.received
                  secret: 0ZnXMlgfXXApYulfrnz5pdIpGFtTTFQ3
                  max_attempts: 10
                  timeout: 30
                  headers:
                    X-Custom-Header: value
                  active: true
                  id: a20239e2-f4d6-4a93-9fa1-7dd0534e028e
                  updated_at: '2026-04-01T00:10:00.000000Z'
                  created_at: '2026-04-01T00:00:00.000000Z'
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Failed to create webhook subscription
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      security:
        - BearerAuth: []
  /api/webhooks/subscriptions/{id}/suspend:
    post:
      operationId: webhookSubscription.suspend
      summary: Suspend Webhook
      tags:
        - Webhook
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                reason:
                  type: string
                  default: Manual suspension
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription suspended successfully
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      active:
                        type: boolean
                      suspended_at:
                        type: string
                      suspended_reason:
                        type: string
                    required:
                      - id
                      - active
                      - suspended_at
                      - suspended_reason
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Webhook subscription suspended successfully
                data:
                  id: a20239e2-f4d6-4a93-9fa1-7dd0534e028e
                  active: false
                  suspended_at: '2026-04-01T00:20:00.000000Z'
                  suspended_reason: Manual suspension
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription not found
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '409':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription is already suspended
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '422':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Validation failed
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Failed to suspend webhook subscription
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      security:
        - BearerAuth: []
  /api/webhooks/subscriptions/{id}/resume:
    post:
      operationId: webhookSubscription.resume
      summary: Resume Webhook
      tags:
        - Webhook
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription resumed successfully
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      active:
                        type: boolean
                      suspended_webhooks_count:
                        type: integer
                      retry_job_dispatched:
                        type: boolean
                    required:
                      - id
                      - active
                      - suspended_webhooks_count
                      - retry_job_dispatched
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Webhook subscription resumed successfully
                data:
                  id: a20239e2-f4d6-4a93-9fa1-7dd0534e028e
                  active: true
                  suspended_webhooks_count: 0
                  retry_job_dispatched: true
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription not found
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '409':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Webhook subscription is not suspended
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '422':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Validation failed
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    const: Failed to resume webhook subscription
                  data:
                    type: 'null'
                  errors:
                    anyOf:
                      - type: object
                      - type: string
                required:
                  - success
                  - message
                  - data
                  - errors
      security:
        - BearerAuth: []
components:
  schemas:
    CostaRicaIBAN:
      type: string
      description: Costa Rican IBAN number
      pattern: ^CR\d{20}$
      example: CR02010200000000000001
    CostaRicaPhone:
      type: string
      description: Costa Rican phone number (8 digits starting with 6, 7, or 8, optionally prefixed with 506 country code)
      pattern: ^(506)?[678]\d{7}$
      example: '88881234'
    CostaRicaNationalID:
      type: string
      description: Costa Rican national ID (Cédula)
      pattern: ^\d{9,10}$
      example: '0123456789'
    DocumentIdentifier:
      type: string
      description: Raw document identifier. Accepts national ID, DIMEX, government ID, legal entity ID, autonomous institution ID, DIDI, or passport.
      pattern: ^((0[1-9]|[1-9])\d{8}|1\d{11}|2\d{9}|3\d{9}|4\d{9}|5\d{11}|[A-Za-z0-9]{6,19})$
      example: '111090807'
    PaymentStatus:
      type: string
      enum:
        - pending
        - processing
        - completed
        - failed
        - timeout
        - service_unavailable
        - validation_failed
        - system_error
    TransferType:
      type: string
      enum:
        - debit
        - credit
    PaymentType:
      type: string
      enum:
        - pin
        - sinpe
    AccountOrigin:
      type: string
      enum:
        - loans
        - special_savings
        - payroll_deduction_savings
        - credit_card
        - bank_ledger
    AccountStatus:
      type: string
      enum:
        - inactive
        - active
        - closed
    PhoneVerificationStatus:
      type: string
      enum:
        - registered
        - not_registered
    IBANStatus:
      type: string
      enum:
        - active
        - closed
        - blocked
    AccountDetailsResource:
      type: object
      properties:
        id:
          type: string
        document_number:
          type: string
        document_type:
          type: integer
        iban:
          type: string
        balance:
          type: object
          properties:
            value:
              type: integer
              description: Amount in minor units of the currency. For example, 1000 is equivalent to 10.00.
              example: 1000
            currency:
              type: string
            formatted:
              type: string
          required:
            - value
            - currency
            - formatted
        owner_name:
          type: string
        status:
          $ref: '#/components/schemas/AccountStatus'
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - document_number
        - document_type
        - iban
        - balance
        - owner_name
        - status
        - created_at
        - updated_at
      title: AccountDetailsResource
    AccountResource:
      type: object
      properties:
        id:
          type: string
        iban:
          type: string
        currency:
          $ref: '#/components/schemas/Currency'
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - iban
        - currency
        - created_at
        - updated_at
      title: AccountResource
    AccountWithBalanceResource:
      type: object
      properties:
        iban:
          type: string
        currency:
          type: string
        balance:
          type: integer
          description: Amount in minor units of the currency. For example, 1000 is equivalent to 10.00.
          example: 1000
        formatted:
          type: string
      required:
        - iban
        - currency
        - balance
        - formatted
      title: AccountWithBalanceResource
    CreateAccountRequest:
      type: object
      properties:
        currency:
          $ref: '#/components/schemas/Currency'
      required:
        - currency
      title: CreateAccountRequest
    Currency:
      type: string
      enum:
        - CRC
        - USD
      title: Currency
    PaymentResource:
      type: object
      properties:
        id:
          type: string
          description: Identifiers
        idempotency_key:
          type: string
        cgp_ref_number:
          type: integer
        channel_reference:
          type: string
        sinpe_reference:
          type: string
        transfer_type:
          type: string
          description: Transfer direction.
          enum:
            - credit
            - debit
        status:
          type: string
        amount:
          type: object
          properties:
            value:
              type: integer
              description: Amount in minor units of the currency. For example, 1000 is equivalent to 10.00.
              example: 10000
            currency:
              type: string
            formatted:
              type: string
          required:
            - value
            - currency
            - formatted
        fee:
          type:
            - object
            - 'null'
          description: Fee amount for the payment. This can be null while the payment status is pending or processing, and is only defined once the payment is completed.
          properties:
            value:
              type: integer
              description: Amount in minor units of the currency. For example, 1000 is equivalent to 10.00.
              example: 100
            currency:
              type: string
            formatted:
              type: string
          required:
            - value
            - currency
            - formatted
        payer:
          type: object
          description: Payer and Payee
          properties:
            iban:
              type: string
            document_number:
              type: string
            document_type:
              type: integer
            name:
              type: string
          required:
            - iban
            - document_number
            - document_type
            - name
        payee:
          type: object
          properties:
            document_number:
              type: string
            document_type:
              type: integer
            name:
              type: string
            phone_number:
              type: string
            iban:
              type: string
          required:
            - document_number
            - document_type
            - name
            - iban
        description:
          type:
            - string
            - 'null'
          description: Messages
        reference:
          type:
            - string
            - 'null'
        error_message:
          type:
            - string
            - 'null'
        created_at:
          type: string
          description: Dates
        submitted_at:
          type: string
        completed_at:
          type: string
        channel:
          type: string
          description: Payment channel.
          enum:
            - pin
            - sinpe_movil
      required:
        - id
        - idempotency_key
        - cgp_ref_number
        - channel_reference
        - sinpe_reference
        - transfer_type
        - status
        - amount
        - fee
        - payer
        - payee
        - description
        - reference
        - error_message
        - created_at
        - submitted_at
        - completed_at
        - channel
      title: PaymentResource
    SendPaymentRequest:
      type: object
      properties:
        source_account_id:
          type: string
          format: uuid
        recipient_iban:
          type:
            - string
            - 'null'
          pattern: ^CR\d{20}$
        recipient_phone:
          type:
            - string
            - 'null'
          pattern: ^(506)?[2678]\d{7}$
        recipient_email:
          type:
            - string
            - 'null'
          format: email
          maxLength: 255
        amount:
          type: integer
          description: Amount in minor units of the currency. For example, 1000 is equivalent to 10.00.
          minimum: 1
          maximum: 500000000
          example: 1000
        reference:
          type:
            - string
            - 'null'
          maxLength: 100
        description:
          type:
            - string
            - 'null'
          maxLength: 500
      required:
        - source_account_id
        - amount
      title: SendPaymentRequest
    StoreWebhookSubscriptionRequest:
      type: object
      properties:
        url:
          type: string
          format: uri
          maxLength: 2048
        max_attempts:
          type: integer
          minimum: 1
          maximum: 10
        timeout:
          type: integer
          minimum: 5
          maximum: 120
        events:
          type: array
          items:
            type: string
            enum:
              - payment.created
              - payment.processing
              - payment.completed
              - payment.failed
              - transaction.received
          minItems: 1
        headers:
          type: array
          items:
            type: string
            maxLength: 255
      required:
        - url
        - events
      title: StoreWebhookSubscriptionRequest
    UserResource:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        email:
          type: string
        email_verified_at:
          type:
            - string
            - 'null'
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - name
        - email
        - email_verified_at
        - created_at
        - updated_at
      title: UserResource
    CreatedWebhookSubscription:
      type: object
      properties:
        url:
          type: string
        events:
          type: array
          items:
            type: string
        secret:
          type: string
        max_attempts:
          type: integer
        timeout:
          type: integer
        headers:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
        active:
          type: boolean
        id:
          type: string
        updated_at:
          type: string
          format: date-time
        created_at:
          type: string
          format: date-time
      required:
        - url
        - events
        - secret
        - max_attempts
        - timeout
        - headers
        - active
        - id
        - updated_at
        - created_at
      title: CreatedWebhookSubscription
    WebhookSubscription:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
        events:
          type: array
          items:
            type: string
        active:
          type: boolean
        max_attempts:
          type: integer
        timeout:
          type: integer
        headers:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
        last_sent_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        suspended_at:
          type:
            - string
            - 'null'
          format: date-time
        suspended_reason:
          type:
            - string
            - 'null'
      required:
        - id
        - url
        - events
        - active
        - max_attempts
        - timeout
        - headers
        - last_sent_at
        - created_at
        - updated_at
        - suspended_at
        - suspended_reason
      title: WebhookSubscription
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          example:
            success: false
            message: Source account is required
            data: null
            errors: {}
          schema:
            type: object
            properties:
              success:
                type: boolean
                const: false
              message:
                type: string
                description: Error overview.
              data:
                type: 'null'
              errors:
                type: object
                description: Additional error details when available.
                additionalProperties: true
            required:
              - success
              - message
              - data
              - errors
    ValidationException:
      description: Validation error
      content:
        application/json:
          example:
            success: false
            message: Source account is required
            data: null
            errors: {}
          schema:
            type: object
            properties:
              success:
                type: boolean
                const: false
              message:
                type: string
                description: Errors overview.
              data:
                type: 'null'
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - success
              - message
              - data
              - errors
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          example:
            success: false
            message: Source account is required
            data: null
            errors: {}
          schema:
            type: object
            properties:
              success:
                type: boolean
                const: false
              message:
                type: string
                description: Error overview.
              data:
                type: 'null'
              errors:
                type: object
                description: Additional error details when available.
                additionalProperties: true
            required:
              - success
              - message
              - data
              - errors
