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

# Processa o pagamento

> Este endpoint tem por finalidade realizar o processamento do pagamento de um seguro viagem já contratado.

O pagamento pode ser realizado através de:
- **PIX**: Envie apenas `payment_method: "pix"`
- **Cartão de Crédito**: Envie `payment_method: "credit_card"` junto com os dados do cartão

| **Campos** | **Tipo** | **Descrição** |
| --- | --- | --- |
| `payment_method` | `string` | Método de pagamento: `pix` ou `credit_card` |
| `credit_card` | `object` | Objeto com dados do cartão (obrigatório se payment_method for credit_card) |
| `credit_card.number` | `string` | Número do cartão de crédito |
| `credit_card.expirate_at` | `string` | Data de expiração no formato MMAA |
| `credit_card.cvv` | `string` | Código de segurança do cartão |


<ParamField path="payPerUseId" type="integer" initialValue="9" required>
  ID do seguro PayPerUse para o qual o pagamento será processado. Este ID é retornado após a contratação do seguro.
</ParamField>

<ParamField header="Accept" type="string" initialValue="application/json" required>
  Cabeçalho que indica o tipo de conteúdo aceito na resposta. Deve ser sempre `application/json`.
</ParamField>


## OpenAPI

````yaml POST /payperuse/{payPerUseId}/payments
openapi: 3.0.3
info:
  title: PayPerUse Unified API
  description: >
    API para contratação e gerenciamento de seguros viagem para dispositivos
    móveis.


    Esta API permite cotar planos, contratar seguros, processar pagamentos e
    gerenciar seguros viagem.


    Observação: Utilize sempre os cabeçalhos `Content-Type` e `Accept` como
    `application/json`
  version: 1.0.0
servers:
  - url: https://homolog.clubfix.com.br/webservice
    description: Ambiente de Homologação
  - url: https://clubfix.com.br/webservice
    description: Ambiente de Produção
security:
  - bearerAuth: []
tags:
  - name: Autenticação
    description: Endpoints para autenticação e obtenção de tokens
  - name: Cotação
    description: Endpoints para cotação de planos de seguro viagem
  - name: Contratação
    description: Endpoints para contratação de seguros viagem
  - name: Pagamento
    description: Endpoints para processamento de pagamentos
  - name: Anexos
    description: Endpoints para anexar documentos
  - name: Seguros
    description: Endpoints para consulta e gerenciamento de seguros
paths:
  /payperuse/{payPerUseId}/payments:
    post:
      tags:
        - Pagamento
      summary: Processa o pagamento de um seguro viagem
      description: >
        Este endpoint tem por finalidade realizar o processamento do pagamento
        de um seguro viagem já contratado.


        O pagamento pode ser realizado através de:

        - **PIX**: Envie apenas `payment_method: "pix"`

        - **Cartão de Crédito**: Envie `payment_method: "credit_card"` junto com
        os dados do cartão


        | **Campos** | **Tipo** | **Descrição** |

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

        | `payment_method` | `string` | Método de pagamento: `pix` ou
        `credit_card` |

        | `credit_card` | `object` | Objeto com dados do cartão (obrigatório se
        payment_method for credit_card) |

        | `credit_card.number` | `string` | Número do cartão de crédito |

        | `credit_card.expirate_at` | `string` | Data de expiração no formato
        MMAA |

        | `credit_card.cvv` | `string` | Código de segurança do cartão |
      operationId: processPayment
      parameters:
        - name: payPerUseId
          in: path
          required: true
          description: ID do seguro PayPerUse
          schema:
            type: integer
            example: 9
        - name: Accept
          in: header
          required: true
          schema:
            type: string
            default: application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentRequest'
            examples:
              pix:
                summary: Pagamento com PIX
                value:
                  payment_method: pix
              credit_card:
                summary: Pagamento com Cartão de Crédito
                value:
                  payment_method: credit_card
                  credit_card:
                    number: '5525881706322623'
                    expirate_at: '0227'
                    cvv: '464'
      responses:
        '200':
          description: Pagamento processado com sucesso
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InsuranceWithPayment'
              examples:
                pix:
                  summary: Resposta de pagamento PIX
                  value:
                    id: 8
                    days: 15
                    starts_at: '2025-12-17'
                    ends_at: '2025-12-31'
                    cancel_limit_date: '2025-12-16'
                    maxima: 10000
                    amount: 90
                    origin: Curitiba - PR
                    local: null
                    created_at: '2025-12-17T04:00:45.000000Z'
                    status:
                      status: pending
                      created_at: '2025-12-17T04:00:45.000000Z'
                    ticket: null
                    ticket_number: '11015420250171'
                    payment:
                      id: 7
                      insurance_id: 8
                      partner_id: 1
                      transaction_id: pay_s004nemoedsdeuno
                      usn: null
                      amount: '90.00'
                      refunded_total: '0.00'
                      payment_method: pix
                      transaction_date: '2025-12-17T04:33:30.000000Z'
                      cancelled_at: null
                      installments: 1
                      created_at: '2025-12-17T04:28:39.000000Z'
                      updated_at: '2025-12-17T04:33:30.000000Z'
                      deleted_at: null
                      qr_code: >-
                        iVBORw0KGgoAAAANSUhEUgAAAcIAAAHCAQAAAABUY/ToAAADIElEQVR4Xu2TQY7cMAwEffP/f5Rn+TZxVVOa3QCBg72EA5D2ylSzq/cgzfH6Yf06/lT+tYZ8qiGfasinGvKphnyq/0Zeh3XezXndz+t+XzbO9ueWlnPIziSd1kyMiC+UIeyWc8jeZKkAGuUTlM9O2PyQ7ckFsmAOKLaih/wg8mXPtuBUbRkP+RlkGJFlW9cCs4v7lT5kZ3Kf+ONTziH/+jQgdzHizXXwL5dCb67BqiHbkp7v6fy2ZoHJoRNWiTUwYci2pKxnnYSaRWRlr1axQ/YmnQZOxWaKu4pMUtAh+5LZMi75Wj/vfNAjpqOGbEtujhFmHAH1gx8YhEofsi0pjAwtCow7sdKxGeFuyLYkTtB8aQmoz/ITAWPokJ3JKse8pBinGGBZMhqyM+mepVTZknJFbLwPTodsTdYdyEgnI+UrN8M9fSLYDdmWxLyW0KwVxUehGHdD9iYZRC+rDqr4xIMne8jW5FvAEMpuEeYlrPQh25JsTyR/2vRYcSc1DavpCRiyMeld2LehwqIkJk9MQYdsS8bzWtdBS0LebtvMh2xOCnvW1aeMCLOybOMbsi2pHAtz3Gatiaq/8PoXzIfsTXr2TmuoskHbeF6iQ7Ylw6LcGotRMdrgNCwmvEP2JbFwAUL7KiRBnymMEYbsTTJZx42xuPomI0/1EEP2JemxXZ43qwKebyAoGuiQjUkJHCCZFPrNn+2Q3cmwQqx4EyRmgOtOG7IzySBT/Im4RdEyZ/sWh2xMvn24ji/O5Cw98RkM2ZeMZbnVjSk38DYkZsjeJACTg8JxQWBIhrqTnTRkZxI5frj9BkOstIgkDtmWxJWbQMRyLcmt2V9yh2xN6tcqFM6YohxXjO2QfclMlJyFT51s1bB5GxIzZFty1T51mhWS3LVJ7JCtyasOfXGethYmSywHNOiQfUk61gtLAdj1R0aPgmXI3uTteJ+yEVV4klVxdTGG/ATSgVwymMVnlSObIfuTiGzgKis+f8/pEzhkazLScvotBx9T8p4IjobsSx7W9leG8skNiKEQcobsTP6ohnyqIZ9qyKca8qmGfKoPI38D2uBY1FsXHIcAAAAASUVORK5CYII=
                      qr_code_expiration: '2026-12-19T02:59:59.000000Z'
                      reason: null
                      protocol: null
                      qr_code_base64: data:image/svg+xml;base64,...
                      status:
                        id: 14
                        payment_id: 7
                        status: pending
                        created_at: '2025-12-17T04:33:30.000000Z'
                        updated_at: '2025-12-17T04:33:30.000000Z'
                        deleted_at: null
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Erro de validação
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
              example:
                message: The given data was invalid.
                errors:
                  credit_card:
                    - validation.required_if
                  credit_card.number:
                    - validation.required_if
                  credit_card.expirate_at:
                    - validation.required_if
                  credit_card.cvv:
                    - validation.required_if
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    PaymentRequest:
      type: object
      required:
        - payment_method
      properties:
        payment_method:
          type: string
          enum:
            - pix
            - credit_card
          description: Método de pagamento
          example: pix
        credit_card:
          type: object
          description: >-
            Dados do cartão de crédito (obrigatório se payment_method for
            credit_card)
          required:
            - number
            - expirate_at
            - cvv
          properties:
            number:
              type: string
              description: Número do cartão de crédito
              example: '5525881706322623'
            expirate_at:
              type: string
              description: Data de expiração no formato MMAA
              example: '0227'
            cvv:
              type: string
              description: Código de segurança do cartão
              example: '464'
    InsuranceWithPayment:
      allOf:
        - $ref: '#/components/schemas/Insurance'
        - type: object
          properties:
            payment:
              $ref: '#/components/schemas/Payment'
    ValidationError:
      type: object
      properties:
        message:
          type: string
          example: The given data was invalid.
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          example:
            credit_card:
              - validation.required_if
            credit_card.number:
              - validation.required_if
            credit_card.expirate_at:
              - validation.required_if
            credit_card.cvv:
              - validation.required_if
    Insurance:
      type: object
      properties:
        id:
          type: integer
          example: 14
        days:
          type: integer
          description: Número de dias de vigência
          example: 12
        starts_at:
          type: string
          format: date
          example: '2025-12-20'
        ends_at:
          type: string
          format: date
          example: '2025-12-31'
        cancel_limit_date:
          type: string
          format: date
          description: Data limite para cancelamento
          example: '2025-12-19'
        maxima:
          type: integer
          example: 10000
        amount:
          type: number
          format: float
          example: 90
        origin:
          type: string
          example: Curitiba - PR
        local:
          type: string
          nullable: true
          example: null
        created_at:
          type: string
          format: date-time
          example: '2025-12-19T20:06:26.000000Z'
        status:
          $ref: '#/components/schemas/InsuranceStatus'
        ticket:
          $ref: '#/components/schemas/Ticket'
          nullable: true
        ticket_number:
          type: string
          example: '11015420250171'
    Payment:
      type: object
      properties:
        id:
          type: integer
          example: 7
        insurance_id:
          type: integer
          example: 8
        partner_id:
          type: integer
          example: 1
        transaction_id:
          type: string
          example: pay_s004nemoedsdeuno
        usn:
          type: string
          nullable: true
          example: null
        amount:
          type: string
          example: '90.00'
        refunded_total:
          type: string
          example: '0.00'
        payment_method:
          type: string
          enum:
            - pix
            - credit_card
          example: pix
        transaction_date:
          type: string
          format: date-time
          example: '2025-12-17T04:33:30.000000Z'
        cancelled_at:
          type: string
          format: date-time
          nullable: true
          example: null
        installments:
          type: integer
          example: 1
        created_at:
          type: string
          format: date-time
          example: '2025-12-17T04:28:39.000000Z'
        updated_at:
          type: string
          format: date-time
          example: '2025-12-17T04:33:30.000000Z'
        deleted_at:
          type: string
          format: date-time
          nullable: true
          example: null
        qr_code:
          type: string
          description: QR Code do PIX em base64 (apenas para pagamentos PIX)
          example: >-
            iVBORw0KGgoAAAANSUhEUgAAAcIAAAHCAQAAAABUY/ToAAADIElEQVR4Xu2TQY7cMAwEffP/f5Rn+TZxVVOa3QCBg72EA5D2ylSzq/cgzfH6Yf06/lT+tYZ8qiGfasinGvKphnyq/0Zeh3XezXndz+t+XzbO9ueWlnPIziSd1kyMiC+UIeyWc8jeZKkAGuUTlM9O2PyQ7ckFsmAOKLaih/wg8mXPtuBUbRkP+RlkGJFlW9cCs4v7lT5kZ3Kf+ONTziH/+jQgdzHizXXwL5dCb67BqiHbkp7v6fy2ZoHJoRNWiTUwYci2pKxnnYSaRWRlr1axQ/YmnQZOxWaKu4pMUtAh+5LZMi75Wj/vfNAjpqOGbEtujhFmHAH1gx8YhEofsi0pjAwtCow7sdKxGeFuyLYkTtB8aQmoz/ITAWPokJ3JKse8pBinGGBZMhqyM+mepVTZknJFbLwPTodsTdYdyEgnI+UrN8M9fSLYDdmWxLyW0KwVxUehGHdD9iYZRC+rDqr4xIMne8jW5FvAEMpuEeYlrPQh25JsTyR/2vRYcSc1DavpCRiyMeld2LehwqIkJk9MQYdsS8bzWtdBS0LebtvMh2xOCnvW1aeMCLOybOMbsi2pHAtz3Gatiaq/8PoXzIfsTXr2TmuoskHbeF6iQ7Ylw6LcGotRMdrgNCwmvEP2JbFwAUL7KiRBnymMEYbsTTJZx42xuPomI0/1EEP2JemxXZ43qwKebyAoGuiQjUkJHCCZFPrNn+2Q3cmwQqx4EyRmgOtOG7IzySBT/Im4RdEyZ/sWh2xMvn24ji/O5Cw98RkM2ZeMZbnVjSk38DYkZsjeJACTg8JxQWBIhrqTnTRkZxI5frj9BkOstIgkDtmWxJWbQMRyLcmt2V9yh2xN6tcqFM6YohxXjO2QfclMlJyFT51s1bB5GxIzZFty1T51mhWS3LVJ7JCtyasOfXGethYmSywHNOiQfUk61gtLAdj1R0aPgmXI3uTteJ+yEVV4klVxdTGG/ATSgVwymMVnlSObIfuTiGzgKis+f8/pEzhkazLScvotBx9T8p4IjobsSx7W9leG8skNiKEQcobsTP6ohnyqIZ9qyKca8qmGfKoPI38D2uBY1FsXHIcAAAAASUVORK5CYII=
        qr_code_expiration:
          type: string
          format: date-time
          description: Data de expiração do QR Code (apenas para pagamentos PIX)
          example: '2026-12-19T02:59:59.000000Z'
        reason:
          type: string
          nullable: true
          example: null
        protocol:
          type: string
          nullable: true
          example: null
        qr_code_base64:
          type: string
          description: QR Code em formato base64 SVG (apenas para pagamentos PIX)
          example: data:image/svg+xml;base64,...
        status:
          type: object
          properties:
            id:
              type: integer
            payment_id:
              type: integer
            status:
              type: string
            created_at:
              type: string
              format: date-time
            updated_at:
              type: string
              format: date-time
            deleted_at:
              type: string
              format: date-time
              nullable: true
    InsuranceStatus:
      type: object
      properties:
        status:
          type: string
          example: pending
        created_at:
          type: string
          format: date-time
          example: '2025-12-19T20:06:26.000000Z'
    Ticket:
      type: object
      properties:
        link:
          type: string
          format: uri
          description: Link para impressão do bilhete
          example: >-
            http://localhost:8000/partnership/payperuse/events/bilhetes/6022a54610f94d05ab73905057a8be73
        expires_at:
          type: string
          format: date-time
          description: Data de expiração do link
          example: '2025-12-19 17:16:00'
  responses:
    Unauthorized:
      description: Não autorizado. Token inválido ou ausente.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                example: Unauthenticated.
    ServerError:
      description: Erro interno do servidor
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                example: Internal server error.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Token de autenticação obtido através do endpoint de autenticação

````