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

# Reverter pagamento

> Reverte um pagamento com os dados informados.



## OpenAPI

````yaml https://payment-ms.supergasbras.app/swagger/v1/swagger.json post /v1/payments/{paymentId}/reverse
openapi: 3.0.4
info:
  title: Payment
  description: >-
    A API Payment é responsável pelo gerenciamento de comerciantes (merchants), 

    incluindo funcionalidades para adquirentes, provedores, processamento de
    pagamentos, 

    entre outras atividades de pagamento.
  version: v1
  x-logo:
    url: |-
      data:image/png;base64,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
    altText: Logo
servers: []
security:
  - Bearer: []
tags:
  - name: Customers
    description: Representa as informações dos clientes no sistema de pagamento.
  - name: Merchants
    description: Representa as informações dos comerciantes no sistema de pagamento.
  - name: Methods
    description: >-
      Representa as informações dos métodos de pagamento no sistema de
      pagamento.
  - name: Payments
    description: Representa as informações dos clientes no sistema de pagamento.
  - name: Providers
    description: Representa as informações dos comerciantes no sistema de pagamento.
paths:
  /v1/payments/{paymentId}/reverse:
    post:
      tags:
        - Payments
      summary: Reverter pagamento
      description: Reverte um pagamento com os dados informados.
      operationId: reversePayment
      parameters:
        - name: paymentId
          in: path
          description: Identificador do pagamento
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Dados de reversão
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReversePaymentCommand'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentDtoIDataResponse'
        '400':
          description: Algum parâmetro está faltando ou está incorreto.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IErrorDataResponse'
        '401':
          description: O usuário não está autenticado, o token está expirado ou é inválido.
          content:
            application/json: {}
        '403':
          description: O usuário não tem as permissões necessárias para o acesso.
          content:
            application/json: {}
        '404':
          description: O comerciante ou pagamento com o identificador informado não existe.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IErrorDataResponse'
        '409':
          description: >-
            A operação não pôde ser concluída devido a um conflito com o estado
            atual do recurso.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IErrorDataResponse'
        '422':
          description: >-
            Os dados enviados não atendem às regras de validação. Revise as
            informações e tente novamente.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IErrorDataResponse'
        '500':
          description: Ocorreu um erro inesperado ao processar a solicitação.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IErrorDataResponse'
components:
  schemas:
    ReversePaymentCommand:
      type: object
      properties:
        amount:
          $ref: '#/components/schemas/AmountCommon'
        additional:
          type: object
          additionalProperties:
            nullable: true
          description: Dados adicionais para reversão do pagamento
          nullable: true
          example:
            reference: 69d0f79e-d524-45d9-92d0-a3d44aa75731
      additionalProperties: false
    PaymentDtoIDataResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/PaymentDto'
      additionalProperties: false
    IErrorDataResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorData'
          nullable: true
          readOnly: true
      additionalProperties: false
    AmountCommon:
      type: object
      properties:
        value:
          type: integer
          description: Valor monetário inteiro
          format: int64
          example: 1000
      additionalProperties: false
      description: Valor monetário inteiro sem moeda
    PaymentDto:
      required:
        - amount
        - capture
        - descriptor
        - errors
        - id
        - merchant
        - merchantProvider
        - method
        - methodResolved
        - note
        - operations
        - orderId
        - state
        - status
      type: object
      properties:
        orderId:
          type: string
          description: Identificador do pedido
          format: uuid
          example: 89f02752-acc9-4a1d-84c7-cdedd61a7a6c
        merchant:
          $ref: '#/components/schemas/MerchantSummaryDto'
        merchantProvider:
          $ref: '#/components/schemas/MerchantProviderSummaryDto'
        methodResolved:
          $ref: '#/components/schemas/MethodSummaryDto'
        customer:
          $ref: '#/components/schemas/CustomerSummaryDto'
        amount:
          $ref: '#/components/schemas/MoneyAmountDto'
        descriptor:
          minLength: 1
          type: string
          description: Descrição do pagamento na fatura
          example: SUPER
        note:
          minLength: 1
          type: string
          description: Nota do pagamento
          example: Pagamento do pedido 123456
        environment:
          enum:
            - physical
            - digital
          type: string
          description: Ambiente do pagamento
          nullable: true
          example: Digital
        capture:
          $ref: '#/components/schemas/PaymentCaptureDto'
        expiryAt:
          type: string
          description: |-
            Data de expiração do pagamento
                        
            É esperada uma string de timestamp no formato RFC3339.
          format: date-time
          nullable: true
          example: '2030-06-05T23:59:59-03:00'
        link:
          $ref: '#/components/schemas/PaymentLinkDto'
        external:
          $ref: '#/components/schemas/ExternalDataDto'
        state:
          minLength: 1
          enum:
            - created
            - authorized
            - succeeded
            - cancelled
            - partiallyRefunded
            - refunded
          type: string
          description: Estado do pagamento
          example: Created
        status:
          minLength: 1
          enum:
            - created
            - processing
            - pending
            - authorized
            - capturePending
            - succeeded
            - cancelled
            - refundPending
            - partiallyRefunded
            - refunded
            - failed
          type: string
          description: Situação do pagamento
          example: Pending
        items:
          type: array
          items:
            $ref: '#/components/schemas/PaymentItemDto'
          description: Itens do pagamento
          nullable: true
        method:
          type: object
          additionalProperties:
            nullable: true
          description: Método de pagamento
          example:
            type: Credit
        source:
          type: object
          additionalProperties:
            nullable: true
          description: Fonte de pagamento
          nullable: true
          example:
            type: customer
            customerId: 71ddf226-fd85-4256-b91e-c9419777e4b9
        operations:
          type: array
          items:
            $ref: '#/components/schemas/PaymentOperationDto'
          description: Conjunto de operações relacionadas ao pagamento
        attributes:
          type: object
          additionalProperties:
            nullable: true
          description: Atributos customizados de chave e valor
          nullable: true
          example:
            externalId: '123456'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorData'
          description: Lista de erros associados ao pagamento
        id:
          type: string
          description: Identificador do registro
          format: uuid
        createdAt:
          type: string
          format: date-time
        modifiedAt:
          type: string
          format: date-time
          nullable: true
      additionalProperties: false
      description: Dados de pagamento
    ErrorData:
      type: object
      properties:
        code:
          type: string
          nullable: true
        target:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
      additionalProperties: false
    MerchantSummaryDto:
      required:
        - categoryCode
        - name
        - title
        - url
      type: object
      properties:
        id:
          type: string
          description: Identificador do comerciante
          format: uuid
          example: 4b3f7d9d-2d1d-48dc-987c-7c74baf16ff2
        title:
          minLength: 1
          type: string
          description: Descrição do comerciante
          example: Pedir Gás
        name:
          minLength: 1
          type: string
          description: Nome do comerciante
          example: Pedir Gás
        categoryCode:
          minLength: 1
          type: string
          description: Código da categoria do comerciante
          example: '5172'
        url:
          minLength: 1
          type: string
          description: URL da pagina do comerciante
          example: https://www.supergasbras.com.br
        attributes:
          type: object
          additionalProperties:
            nullable: true
          description: Atributos customizados de chave e valor
          nullable: true
          example:
            externalId: '123456'
      additionalProperties: false
    MerchantProviderSummaryDto:
      required:
        - name
        - provider
      type: object
      properties:
        id:
          type: string
          description: Identificador do provedor do comerciante
          format: uuid
          example: 13ef8495-8815-49c8-84fc-382e2cf7a441
        provider:
          $ref: '#/components/schemas/ProviderSummaryDto'
        name:
          minLength: 1
          type: string
          description: Nome do provedor
          example: Getnet SEP
      additionalProperties: false
    MethodSummaryDto:
      required:
        - environment
        - name
        - type
      type: object
      properties:
        name:
          minLength: 1
          type: string
          description: Nome do método de pagamento
          example: Dinheiro
        type:
          minLength: 1
          type: string
          description: Tipo do método de pagamento
          example: Cash
        environment:
          minLength: 1
          enum:
            - physical
            - digital
          type: string
          description: Ambiente do pagamento
          example: Physical
      additionalProperties: false
    CustomerSummaryDto:
      required:
        - name
        - phoneNumber
      type: object
      properties:
        id:
          type: string
          description: Identificador do cliente
          format: uuid
          example: 71ddf226-fd85-4256-b91e-c9419777e4b9
        name:
          minLength: 1
          type: string
          description: Nome do cliente
          example: João Silva
        phoneNumber:
          minLength: 1
          type: string
          description: Número de telefone do cliente
          example: '+5511999999999'
        email:
          type: string
          description: Email do cliente
          nullable: true
          example: joao.silva@test.com
        document:
          $ref: '#/components/schemas/CustomerDocumentDto'
        billingAddress:
          $ref: '#/components/schemas/AddressDto'
        attributes:
          type: object
          additionalProperties:
            nullable: true
          description: Atributos customizados de chave e valor
          nullable: true
          example:
            externalId: '123456'
      additionalProperties: false
      description: Dados do cliente
    MoneyAmountDto:
      type: object
      properties:
        value:
          type: integer
          description: Valor monetário inteiro
          format: int64
          example: 1000
        currency:
          type: string
          description: Moeda
          nullable: true
          example: BRL
      additionalProperties: false
      description: Valor monetário inteiro com moeda
    PaymentCaptureDto:
      required:
        - type
      type: object
      properties:
        type:
          minLength: 1
          enum:
            - automatic
          type: string
          description: Tipo da captura de pagamento
          example: Automatic
      additionalProperties: false
      description: Dados da captura de pagamento
    PaymentLinkDto:
      type: object
      properties:
        url:
          type: string
          description: Url do link de pagamento
          nullable: true
          example: https://pagseguro.com.br/v2/checkout/payment.html?code=123456789
        external:
          $ref: '#/components/schemas/ExternalDataDto'
      additionalProperties: false
      description: Dados do link de pagamento
    ExternalDataDto:
      type: object
      properties:
        id:
          type: string
          description: Identificador externo
          nullable: true
          example: 4acebcae92674de18aab02f7a2df2c3c
      additionalProperties: false
      description: Dados externos
    PaymentItemDto:
      required:
        - description
        - name
        - price
        - quantity
      type: object
      properties:
        name:
          minLength: 1
          type: string
          description: Nome do item
          example: Botijão P13
        description:
          minLength: 1
          type: string
          description: Descrição do item
          example: Botijão GLP P13
        quantity:
          type: integer
          description: Quantidade do item
          format: int32
          example: 3
        price:
          $ref: '#/components/schemas/MoneyAmountDto'
      additionalProperties: false
      description: Dados do item de pagamento
    PaymentOperationDto:
      required:
        - id
      type: object
      properties:
        type:
          enum:
            - none
            - authorization
            - capture
            - refund
            - cancellation
          type: string
          description: Tipo da operação de pagamento
          nullable: true
          example: Authorization
        amount:
          $ref: '#/components/schemas/MoneyAmountDto'
        idempotencyKey:
          type: string
          description: Chave de idempotência
          nullable: true
          example: f8347c15-57b7-4213-9c96-00942597b72b
        status:
          enum:
            - pending
            - succeeded
            - failed
          type: string
          description: Situação da operação de pagamento
          nullable: true
          example: Created
        external:
          $ref: '#/components/schemas/ExternalDataDto'
        reason:
          $ref: '#/components/schemas/ReasonDetailsDto'
        attributes:
          type: object
          additionalProperties:
            nullable: true
          description: Atributos customizados de chave e valor
          nullable: true
          example:
            externalId: '123456'
        id:
          type: string
          description: Identificador do registro
          format: uuid
        createdAt:
          type: string
          format: date-time
        modifiedAt:
          type: string
          format: date-time
          nullable: true
      additionalProperties: false
      description: Dados da operação de pagamento
    ProviderSummaryDto:
      required:
        - code
        - environment
        - id
        - name
        - type
      type: object
      properties:
        id:
          type: string
          description: Identificador do provedor
          format: uuid
          example: e71f2762-e4c4-4ef6-8764-02b97f347ec4
        name:
          minLength: 1
          type: string
          description: Nome do provedor
          example: Getnet SEP
        code:
          minLength: 1
          type: string
          description: Código do provedor
          example: getnetSep
        type:
          minLength: 1
          enum:
            - none
            - bank
            - acquirer
            - subAcquirer
            - paymentServiceProvider
            - gateway
            - wallet
            - localPayment
          type: string
          description: Tipo do provedor
          example: Gateway
        environment:
          minLength: 1
          enum:
            - physical
            - digital
          type: string
          description: Ambiente do pagamento
          example: Digital
        resolutionKey:
          type: string
          description: Chave de resolução do provedor
          nullable: true
      additionalProperties: false
    CustomerDocumentDto:
      required:
        - country
        - number
        - type
      type: object
      properties:
        type:
          minLength: 1
          enum:
            - cpf
            - cnpj
          type: string
          description: Tipo do documento
          example: Cpf
        number:
          minLength: 1
          type: string
          description: Número do documento
          example: '22380370044'
        country:
          minLength: 1
          type: string
          description: País associado ao documento.
          example: BR
      additionalProperties: false
      description: Dados do documento
    AddressDto:
      type: object
      properties:
        street:
          type: string
          description: Nome da Rua do endereço
          nullable: true
          example: Avenida Paulista
        number:
          type: string
          description: Numero do endereço
          nullable: true
          example: '1111'
        apartment:
          type: string
          description: Complemento do endereço
          nullable: true
          example: Sala 100
        neighborhood:
          type: string
          description: Bairro do endereço
          nullable: true
          example: Bela Vista
        city:
          type: string
          description: Cidade do endereço
          nullable: true
          example: São Paulo
        state:
          type: string
          description: Estado do endereço
          nullable: true
          example: SP
        country:
          type: string
          description: País do endereço
          nullable: true
          example: BR
        postalCode:
          type: string
          description: Código postal do endereço
          nullable: true
          example: 01311-200
        longitude:
          type: number
          description: Longitude da coordenada
          format: double
          example: -46.653408
        latitude:
          type: number
          description: Latitude da coordenada
          format: double
          example: -23.56475
      additionalProperties: false
      description: Dados do endereço
    ReasonDetailsDto:
      type: object
      properties:
        code:
          type: string
          description: Código do motivo
          nullable: true
          example: invalidCredentials
        message:
          type: string
          description: Mensagem do motivo
          nullable: true
          example: Credenciais inválidas
      additionalProperties: false
      description: Detalhes do motivo
  securitySchemes:
    Bearer:
      type: http
      description: Token de acesso `accessToken` obtido do serviço de autenticação.
      scheme: Bearer
      bearerFormat: JWT

````