{
  "openapi": "3.0.4",
  "info": {
    "title": "Pagamentos e checkout",
    "version": "v2",
    "description": "Spec pública sanitizada pelo DevPortal a partir da spec do serviço (não gerada do código). Ver openapi/public.config.json."
  },
  "paths": {
    "/v2/checkout/init": {
      "post": {
        "tags": [
          "Checkout"
        ],
        "summary": "Inicia uma nova sessão de checkout com base nos dados fornecidos na requisição. Este endpoint valida os dados do request, cria a sessão de checkout \r\ne retorna as informações da sessão criada.",
        "requestBody": {
          "description": "Objeto contendo os dados necessários para iniciar a sessão de checkout.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutInitRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutInitRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutInitRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutSessionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v2/payment": {
      "post": {
        "tags": [
          "Payment"
        ],
        "summary": "Cria um novo pagamento com base nos dados fornecidos na requisição.",
        "description": "Este método valida a requisição de entrada, processa a criação do pagamento através do\r\n            serviço de transação e retorna uma resposta indicando o sucesso ou falha da operação. Se a validação\r\n            falhar, uma resposta de erro de validação é retornada. Se ocorrer um erro interno, uma resposta genérica de erro é\r\n            fornecida.",
        "requestBody": {
          "description": "A requisição de pagamento contendo os detalhes necessários para criar um pagamento.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              },
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              },
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "A requisição original com esta Idempotency-Key ainda está em andamento.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Esta Idempotency-Key já foi usada com um corpo de requisição diferente.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "description": "Chave de idempotência da operação (ADR 0013, seção 4.2, item 1). A mesma chave com o mesmo corpo devolve o resultado original (cabeçalho Idempotent-Replayed: true); com corpo diferente, 422.",
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "maxLength": 128,
              "minLength": 8,
              "pattern": "^[A-Za-z0-9_:-]{8,128}$",
              "type": "string"
            }
          }
        ]
      }
    },
    "/v2/payment/reverse": {
      "put": {
        "tags": [
          "Payment"
        ],
        "summary": "Reverte um pagamento previamente autorizado ou capturado com base nos dados fornecidos na requisição.",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReversePaymentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              },
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              },
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDefault"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "A requisição original com esta Idempotency-Key ainda está em andamento.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Esta Idempotency-Key já foi usada com um corpo de requisição diferente.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "description": "Chave de idempotência da operação (ADR 0013, seção 4.2, item 1). A mesma chave com o mesmo corpo devolve o resultado original (cabeçalho Idempotent-Replayed: true); com corpo diferente, 422.",
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "maxLength": 128,
              "minLength": 8,
              "pattern": "^[A-Za-z0-9_:-]{8,128}$",
              "type": "string"
            }
          }
        ]
      }
    },
    "/v2/payment/transactions": {
      "get": {
        "tags": [
          "Payment"
        ],
        "summary": "Recupera uma lista de transações com base nos critérios de filtro especificados.",
        "parameters": [
          {
            "name": "SellerId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "BuyerId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Amount",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "Status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/PaymentStatus"
            }
          },
          {
            "name": "CreatedAtTo",
            "in": "query",
            "description": "O limite superior para a data de criação da transação. Junto com CreatedAtFrom, as duas vêm sempre juntas ou nenhuma: só uma informada, ou a final menor que a inicial, é `400 TRANSACTION_WINDOW_INVALID`. Sem nenhuma das duas, o servidor aplica como janela efetiva os últimos 7 dias. Com as duas informadas, a diferença entre elas não pode passar de 31 dias (`400 TRANSACTION_WINDOW_TOO_LARGE`).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "CreatedAtFrom",
            "in": "query",
            "description": "O limite inferior para a data de criação da transação. Ver as regras de janela em CreatedAtTo.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "PaymentMethod",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/PaymentMethod"
            }
          },
          {
            "name": "PageSize",
            "in": "query",
            "description": "O número máximo de transações a retornar por página. Deve ser positivo. O padrão é 20 se não especificado. Acima de 100, a requisição é recusada com `400 TRANSACTION_PAGE_SIZE_TOO_LARGE`.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "PageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Requisição inválida. Na listagem, os códigos de teto são `TRANSACTION_PAGE_SIZE_TOO_LARGE` (`PageSize` acima de 100), `TRANSACTION_WINDOW_INVALID` (só uma das datas informada, ou `CreatedAtTo` menor que `CreatedAtFrom`) e `TRANSACTION_WINDOW_TOO_LARGE` (janela acima de 31 dias).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v2/payment/transaction/{transactionId}": {
      "get": {
        "tags": [
          "Payment"
        ],
        "summary": "Recupera a transação especificada.",
        "parameters": [
          {
            "name": "transactionId",
            "in": "path",
            "description": "O identificador único da transação para a qual se deseja obter o status do pagamento.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PaymentMethod": {
        "enum": [
          "notSpecified",
          "creditCard",
          "debitCard",
          "pix",
          "boleto"
        ],
        "type": "string"
      },
      "PaymentStatus": {
        "enum": [
          "none",
          "created",
          "authorized",
          "captured",
          "refunded",
          "failed",
          "canceled",
          "pending",
          "inAnalysis",
          "awaitingPayment",
          "pendingReview",
          "paid"
        ],
        "type": "string"
      },
      "ReversePaymentRequest": {
        "type": "object",
        "properties": {
          "sellerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "buyerId": {
            "type": "string",
            "format": "uuid"
          },
          "transactionId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "externalReference": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ResponseDefault": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "statusCode": {
            "type": "integer",
            "format": "int32"
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Notification"
            },
            "nullable": true
          },
          "data": {
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "Notification": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "propertyName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PaymentRequest": {
        "type": "object",
        "properties": {
          "sellerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "buyerId": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "integer",
            "format": "int32"
          },
          "externalReference": {
            "type": "string",
            "nullable": true
          },
          "paymentMethod": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "transactionType": {
            "$ref": "#/components/schemas/TransactionType"
          },
          "installments": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "splitRuleId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "split": {
            "$ref": "#/components/schemas/SplitRequest"
          },
          "antifraudSessionId": {
            "type": "string",
            "nullable": true
          },
          "card": {
            "$ref": "#/components/schemas/CardRequestDto"
          },
          "threeDS": {
            "$ref": "#/components/schemas/ThreeDSDto"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ThreeDSDto": {
        "type": "object",
        "properties": {
          "externalEMV": {
            "$ref": "#/components/schemas/ExternalEmvDto"
          },
          "internalEMV": {
            "$ref": "#/components/schemas/InternalEmvDto"
          }
        },
        "additionalProperties": false
      },
      "InternalEmvDto": {
        "type": "object",
        "properties": {
          "device": {
            "$ref": "#/components/schemas/DeviceDto"
          },
          "userAgent": {
            "type": "string",
            "nullable": true
          },
          "ip": {
            "type": "string",
            "nullable": true
          },
          "redirectUrl3ds": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DeviceDto": {
        "type": "object",
        "properties": {
          "colorDepth": {
            "type": "string",
            "nullable": true
          },
          "deviceType3ds": {
            "type": "string",
            "nullable": true
          },
          "javaEnabled": {
            "type": "boolean"
          },
          "language": {
            "type": "string",
            "nullable": true
          },
          "screenHeight": {
            "type": "string",
            "nullable": true
          },
          "screenWidth": {
            "type": "string",
            "nullable": true
          },
          "timeZoneOffset": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ExternalEmvDto": {
        "type": "object",
        "properties": {
          "embedded": {
            "type": "boolean",
            "nullable": true
          },
          "cavv": {
            "type": "string",
            "nullable": true
          },
          "eci": {
            "type": "string",
            "nullable": true
          },
          "xid": {
            "type": "string",
            "nullable": true
          },
          "threeDIndicator": {
            "type": "string",
            "nullable": true
          },
          "directoryServerTransactionId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CardRequestDto": {
        "type": "object",
        "properties": {
          "cardTokenId": {
            "type": "string",
            "nullable": true
          },
          "cardToken": {
            "type": "string",
            "nullable": true
          },
          "cardHolderName": {
            "type": "string",
            "nullable": true
          },
          "cardHolderDocument": {
            "type": "string",
            "nullable": true
          },
          "cardNumber": {
            "type": "string",
            "nullable": true
          },
          "expirationMonth": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "expirationYear": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "securityCode": {
            "type": "string",
            "nullable": true
          },
          "generateToken": {
            "type": "boolean",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SplitRequest": {
        "type": "object",
        "properties": {
          "splitRuleId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "recipientIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "nullable": true
          },
          "type": {
            "$ref": "#/components/schemas/SplitType"
          },
          "amount": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "percentage": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SplitType": {
        "enum": [
          "none",
          "fixed",
          "percentage"
        ],
        "type": "string"
      },
      "TransactionType": {
        "enum": [
          "none",
          "sale",
          "refund",
          "recharge"
        ],
        "type": "string"
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": {}
      },
      "CheckoutSessionResponse": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "nullable": true
          },
          "checkoutUrl": {
            "type": "string",
            "nullable": true
          },
          "embedUrl": {
            "type": "string",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CheckoutInitRequest": {
        "type": "object",
        "properties": {
          "buyerId": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "integer",
            "format": "int32"
          },
          "externalReference": {
            "type": "string",
            "nullable": true
          },
          "sellerId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "splitRuleId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "splitRequest": {
            "$ref": "#/components/schemas/SplitRequest"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "transactionType": {
            "$ref": "#/components/schemas/TransactionType"
          },
          "preSelectedPaymentMethod": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "installments": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "preSelectedInstallments": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true
          }
        },
        "additionalProperties": {}
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "apiKey",
        "description": "Cabeçalho de autorização JWT usando o esquema Bearer. Exemplo: \"Authorization: Bearer {token}\"",
        "name": "Authorization",
        "in": "header"
      }
    }
  }
}