{
  "openapi": "3.2.0",
  "info": {
    "title": "Pagath Payments",
    "description": "API de aplicaciones conectadas. OpenAPI, la API y los webhooks tienen versiones independientes. Este documento configura producción. Para Sandbox configure juntos la API https://sandbox.pagath.cu y el token URL https://auth-sandbox.pagath.cu/oauth/token.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.pagath.cu",
      "description": "Producción"
    }
  ],
  "paths": {
    "/v1/payments/order": {
      "post": {
        "tags": [
          "PaymentOrderEndpoints"
        ],
        "summary": "Crear orden",
        "description": "Requiere el permiso `payments:write`. La autenticación y autorización preceden a la lectura del cuerpo JSON. Un 202 confirma un recurso local para seguimiento, no el resultado financiero ni una resolución automática. Ante incertidumbre consulte antes de repetir.",
        "requestBody": {
          "description": "JSON estricto: nombres exactos, sin propiedades comunes desconocidas ni duplicadas, hasta ocho niveles.",
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "gateway",
                  "reference",
                  "amount"
                ],
                "type": "object",
                "properties": {
                  "reference": {
                    "maxLength": 20,
                    "pattern": "\\S",
                    "type": "string",
                    "description": "Número de orden no vacío de la aplicación."
                  },
                  "amount": {
                    "multipleOf": 0.01,
                    "maximum": 1000000,
                    "exclusiveMinimum": 0,
                    "type": "number",
                    "description": "Importe positivo de hasta 1000000, expresado en unidades y centavos."
                  },
                  "description": {
                    "maxLength": 200,
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "gateway": {
                    "pattern": "^[a-z][a-z0-9-]*$",
                    "type": "string",
                    "description": "Nombre abierto de la pasarela."
                  },
                  "webhookTarget": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "gatewayData": {
                    "type": "object",
                    "description": "Datos específicos de la pasarela; omitido equivale a {}."
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Recurso consultado o existente.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "webhookTarget": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "In decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "creationStatus": {
                      "type": "string",
                      "description": "CreationStatuses: creating, created, rejected or unknown."
                    },
                    "paymentStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "PaymentStatuses or null (ADR-0041, Q66)."
                    },
                    "link": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "qrCode": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "When the local window of the order ends (UTC), or null when it has none (spec #75 tema 5). A window that ended is not a financial\nexpiry: the order stays `pending` until the gateway concludes, and a late payment can still arrive (ADR-0030 Q70).",
                      "format": "date-time"
                    }
                  },
                  "description": "What the public API says about an order (ADR-0041, ADR-0044): the resource itself, with Pagath's `id`, the creation and the\npayment result apart. string OrderView.PaymentStatus is null while there is no acceptance nor a reliable result (an order that\nis not `created` and has not left `pending`): `pending` only means an accepted order waiting for its result.\nThe version of the API travels in the `API-Version` header, never in this JSON."
                }
              }
            }
          },
          "201": {
            "description": "Primera creación de orden confirmada; creationStatus es created.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "Location": {
                "description": "Ruta del recurso persistido para seguimiento.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "webhookTarget": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "In decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "creationStatus": {
                      "const": "created",
                      "type": "string"
                    },
                    "paymentStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "PaymentStatuses or null (ADR-0041, Q66)."
                    },
                    "link": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "qrCode": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "When the local window of the order ends (UTC), or null when it has none (spec #75 tema 5). A window that ended is not a financial\nexpiry: the order stays `pending` until the gateway concludes, and a late payment can still arrive (ADR-0030 Q70).",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "creationStatus creating o unknown y paymentStatus null; recurso local persistido, consulte su estado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "Location": {
                "description": "Ruta del recurso persistido para seguimiento.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus",
                    "paymentStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "webhookTarget": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "In decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "creationStatus": {
                      "enum": [
                        "creating",
                        "unknown"
                      ],
                      "type": "string"
                    },
                    "paymentStatus": {
                      "type": "null"
                    },
                    "link": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "qrCode": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "When the local window of the order ends (UTC), or null when it has none (spec #75 tema 5). A window that ended is not a financial\nexpiry: the order stays `pending` until the gateway concludes, and a late payment can still arrive (ADR-0030 Q70).",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "JSON mal formado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "401": {
            "description": "No autenticado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "description": "Desafío de autenticación, cuando corresponda.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "403": {
            "description": "Sin permiso o acceso al recurso.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "503": {
            "description": "service_unavailable: estado no confirmado; reservation_cleanup_pending: descarte de reserva sin confirmar. Consulte antes de reintentar.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "409": {
            "description": "Conflicto con el estado o la identidad de la solicitud.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "422": {
            "description": "Solicitud inválida, operación no soportada o rechazo de pasarela; puede incluir el recurso rechazado conservado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    },
                    "resource": {
                      "required": [
                        "id",
                        "reference",
                        "creationStatus"
                      ],
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "reference": {
                          "type": "string"
                        },
                        "webhookTarget": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "gateway": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "amount": {
                          "type": "number",
                          "description": "In decimals (ADR-0025).",
                          "format": "double"
                        },
                        "currency": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "creationStatus": {
                          "type": "string",
                          "description": "CreationStatuses: creating, created, rejected or unknown."
                        },
                        "paymentStatus": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "description": "PaymentStatuses or null (ADR-0041, Q66)."
                        },
                        "link": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "qrCode": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "expiresAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "description": "When the local window of the order ends (UTC), or null when it has none (spec #75 tema 5). A window that ended is not a financial\nexpiry: the order stays `pending` until the gateway concludes, and a late payment can still arrive (ADR-0030 Q70).",
                          "format": "date-time"
                        }
                      },
                      "description": "What the public API says about an order (ADR-0041, ADR-0044): the resource itself, with Pagath's `id`, the creation and the\npayment result apart. string OrderView.PaymentStatus is null while there is no acceptance nor a reliable result (an order that\nis not `created` and has not left `pending`): `pending` only means an accepted order waiting for its result.\nThe version of the API travels in the `API-Version` header, never in this JSON."
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "payments:write"
            ]
          }
        ]
      }
    },
    "/v1/payments/order/{orderId}": {
      "get": {
        "tags": [
          "Pagath.Payments.Api"
        ],
        "summary": "Consultar orden por id",
        "description": "Requiere el permiso `payments:read`. La autenticación y autorización preceden a la lectura del cuerpo JSON.",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recurso consultado o existente.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "webhookTarget": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "In decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "creationStatus": {
                      "type": "string",
                      "description": "CreationStatuses: creating, created, rejected or unknown."
                    },
                    "paymentStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "PaymentStatuses or null (ADR-0041, Q66)."
                    },
                    "link": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "qrCode": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "When the local window of the order ends (UTC), or null when it has none (spec #75 tema 5). A window that ended is not a financial\nexpiry: the order stays `pending` until the gateway concludes, and a late payment can still arrive (ADR-0030 Q70).",
                      "format": "date-time"
                    }
                  },
                  "description": "What the public API says about an order (ADR-0041, ADR-0044): the resource itself, with Pagath's `id`, the creation and the\npayment result apart. string OrderView.PaymentStatus is null while there is no acceptance nor a reliable result (an order that\nis not `created` and has not left `pending`): `pending` only means an accepted order waiting for its result.\nThe version of the API travels in the `API-Version` header, never in this JSON."
                }
              }
            }
          },
          "401": {
            "description": "No autenticado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "description": "Desafío de autenticación, cuando corresponda.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "403": {
            "description": "Sin permiso o acceso al recurso.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "503": {
            "description": "service_unavailable: no se pudo consultar el estado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "404": {
            "description": "Recurso no encontrado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "payments:read"
            ]
          }
        ]
      }
    },
    "/v1/payments/order/by-reference/{reference}": {
      "get": {
        "tags": [
          "Pagath.Payments.Api"
        ],
        "summary": "Consultar por número de orden",
        "description": "Requiere el permiso `payments:read`. La autenticación y autorización preceden a la lectura del cuerpo JSON.",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recurso consultado o existente.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "webhookTarget": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "In decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "creationStatus": {
                      "type": "string",
                      "description": "CreationStatuses: creating, created, rejected or unknown."
                    },
                    "paymentStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "PaymentStatuses or null (ADR-0041, Q66)."
                    },
                    "link": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "qrCode": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "When the local window of the order ends (UTC), or null when it has none (spec #75 tema 5). A window that ended is not a financial\nexpiry: the order stays `pending` until the gateway concludes, and a late payment can still arrive (ADR-0030 Q70).",
                      "format": "date-time"
                    }
                  },
                  "description": "What the public API says about an order (ADR-0041, ADR-0044): the resource itself, with Pagath's `id`, the creation and the\npayment result apart. string OrderView.PaymentStatus is null while there is no acceptance nor a reliable result (an order that\nis not `created` and has not left `pending`): `pending` only means an accepted order waiting for its result.\nThe version of the API travels in the `API-Version` header, never in this JSON."
                }
              }
            }
          },
          "401": {
            "description": "No autenticado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "description": "Desafío de autenticación, cuando corresponda.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "403": {
            "description": "Sin permiso o acceso al recurso.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "503": {
            "description": "service_unavailable: no se pudo consultar el estado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "404": {
            "description": "Recurso no encontrado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "409": {
            "description": "Conflicto con el estado o la identidad de la solicitud.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "payments:read"
            ]
          }
        ]
      }
    },
    "/v1/payments/order/{orderId}/complete": {
      "post": {
        "tags": [
          "Pagath.Payments.Api"
        ],
        "summary": "Completar orden",
        "description": "Requiere el permiso `payments:write`. La autenticación y autorización preceden a la lectura del cuerpo JSON.",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recurso consultado o existente.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "webhookTarget": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "In decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "creationStatus": {
                      "type": "string",
                      "description": "CreationStatuses: creating, created, rejected or unknown."
                    },
                    "paymentStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "PaymentStatuses or null (ADR-0041, Q66)."
                    },
                    "link": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "qrCode": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "When the local window of the order ends (UTC), or null when it has none (spec #75 tema 5). A window that ended is not a financial\nexpiry: the order stays `pending` until the gateway concludes, and a late payment can still arrive (ADR-0030 Q70).",
                      "format": "date-time"
                    }
                  },
                  "description": "What the public API says about an order (ADR-0041, ADR-0044): the resource itself, with Pagath's `id`, the creation and the\npayment result apart. string OrderView.PaymentStatus is null while there is no acceptance nor a reliable result (an order that\nis not `created` and has not left `pending`): `pending` only means an accepted order waiting for its result.\nThe version of the API travels in the `API-Version` header, never in this JSON."
                }
              }
            }
          },
          "401": {
            "description": "No autenticado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "description": "Desafío de autenticación, cuando corresponda.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "403": {
            "description": "Sin permiso o acceso al recurso.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "503": {
            "description": "service_unavailable: no se pudo consultar el estado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "404": {
            "description": "Recurso no encontrado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "409": {
            "description": "Conflicto con el estado o la identidad de la solicitud.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "422": {
            "description": "Operación no soportada.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "502": {
            "description": "Rechazo o respuesta inválida específica del adaptador.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "504": {
            "description": "La pasarela no respondió; resultado incierto: consulte antes de repetir.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "payments:write"
            ]
          }
        ]
      }
    },
    "/v1/payments/order/{orderId}/cancel": {
      "post": {
        "tags": [
          "Pagath.Payments.Api"
        ],
        "summary": "Cancelar orden",
        "description": "Requiere el permiso `payments:write`. La autenticación y autorización preceden a la lectura del cuerpo JSON.",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recurso consultado o existente.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "webhookTarget": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "In decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "creationStatus": {
                      "type": "string",
                      "description": "CreationStatuses: creating, created, rejected or unknown."
                    },
                    "paymentStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "PaymentStatuses or null (ADR-0041, Q66)."
                    },
                    "link": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "qrCode": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "expiresAt": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "When the local window of the order ends (UTC), or null when it has none (spec #75 tema 5). A window that ended is not a financial\nexpiry: the order stays `pending` until the gateway concludes, and a late payment can still arrive (ADR-0030 Q70).",
                      "format": "date-time"
                    }
                  },
                  "description": "What the public API says about an order (ADR-0041, ADR-0044): the resource itself, with Pagath's `id`, the creation and the\npayment result apart. string OrderView.PaymentStatus is null while there is no acceptance nor a reliable result (an order that\nis not `created` and has not left `pending`): `pending` only means an accepted order waiting for its result.\nThe version of the API travels in the `API-Version` header, never in this JSON."
                }
              }
            }
          },
          "401": {
            "description": "No autenticado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "description": "Desafío de autenticación, cuando corresponda.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "403": {
            "description": "Sin permiso o acceso al recurso.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "503": {
            "description": "service_unavailable: no se pudo consultar el estado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "404": {
            "description": "Recurso no encontrado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "409": {
            "description": "Conflicto con el estado o la identidad de la solicitud.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "422": {
            "description": "Operación no soportada.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "502": {
            "description": "Rechazo o respuesta inválida específica del adaptador.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "504": {
            "description": "La pasarela no respondió; resultado incierto: consulte antes de repetir.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "payments:write"
            ]
          }
        ]
      }
    },
    "/v1/payments/gateways": {
      "get": {
        "tags": [
          "Pagath.Payments.Api"
        ],
        "summary": "Consultar pasarelas disponibles",
        "description": "Requiere el permiso `payments:read`. La autenticación y autorización preceden a la lectura del cuerpo JSON.",
        "responses": {
          "200": {
            "description": "Recurso consultado o existente.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "gateways"
                  ],
                  "type": "object",
                  "properties": {
                    "gateways": {
                      "type": "array",
                      "items": {
                        "required": [
                          "gateway",
                          "displayName",
                          "currency",
                          "capabilities",
                          "gatewayData"
                        ],
                        "type": "object",
                        "properties": {
                          "gateway": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "displayName": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "currency": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "capabilities": {
                            "required": [
                              "refunds",
                              "refundNotices",
                              "requiresCompletion",
                              "payerReturns"
                            ],
                            "type": "object",
                            "properties": {
                              "refunds": {
                                "type": "boolean"
                              },
                              "refundNotices": {
                                "type": "boolean"
                              },
                              "requiresCompletion": {
                                "type": "boolean"
                              },
                              "payerReturns": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              }
                            },
                            "description": "The public capabilities. Promoting another registry capability here is an explicit decision (ADR-0049)."
                          },
                          "gatewayData": {
                            "type": [
                              "null",
                              "array"
                            ],
                            "items": {
                              "required": [
                                "name",
                                "type",
                                "required"
                              ],
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "type": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "required": {
                                  "type": "boolean"
                                }
                              },
                              "description": "A field the order accepts in `gatewayData`; the app sends application-only fields too, so the mark is not shown."
                            }
                          }
                        },
                        "description": "An available gateway as the public API shows it (ADR-0049): a curated subset of the registry, never its internal capabilities."
                      }
                    }
                  },
                  "description": "Public envelope for available gateways."
                }
              }
            }
          },
          "401": {
            "description": "No autenticado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "description": "Desafío de autenticación, cuando corresponda.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "403": {
            "description": "Sin permiso o acceso al recurso.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "503": {
            "description": "service_unavailable: no se pudo consultar el estado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "payments:read"
            ]
          }
        ]
      }
    },
    "/v1/payments/refund": {
      "post": {
        "tags": [
          "RefundEndpoints"
        ],
        "summary": "Crear devolución",
        "description": "Requiere el permiso `refunds:write`. La autenticación y autorización preceden a la lectura del cuerpo JSON. Un 202 confirma un recurso local para seguimiento, no el resultado financiero ni una resolución automática. Ante incertidumbre consulte antes de repetir. Conserve la misma Idempotency-Key para reintentar la misma devolución.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Una sola clave estable por devolución, de 1 a 255 caracteres ASCII [A-Za-z0-9._:-].",
            "required": true,
            "schema": {
              "maxLength": 255,
              "minLength": 1,
              "pattern": "^[A-Za-z0-9._:-]+$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "JSON estricto: nombres exactos, sin propiedades comunes desconocidas ni duplicadas, hasta ocho niveles.",
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "reference",
                  "amount"
                ],
                "type": "object",
                "properties": {
                  "reference": {
                    "pattern": "\\S",
                    "type": "string",
                    "description": "Número de orden no vacío de la aplicación."
                  },
                  "amount": {
                    "multipleOf": 0.01,
                    "maximum": 1000000,
                    "exclusiveMinimum": 0,
                    "type": "number",
                    "description": "Importe positivo de hasta 1000000, expresado en unidades y centavos."
                  },
                  "description": {
                    "maxLength": 200,
                    "type": [
                      "null",
                      "string"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Recurso consultado o existente.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string",
                      "description": "The número de orden of the order refunded."
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "What is refunded, in decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "refundType": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "`total` or `partial`."
                    },
                    "creationStatus": {
                      "type": "string",
                      "description": "CreationStatuses: creating, created, rejected or unknown (ADR-0041): whether the gateway has the devolución, apart from its result."
                    },
                    "refundStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "The result of the devolución itself (`pending`, `succeeded`, `failed`), or null while there is no acceptance nor a\nreliable result: `unknown` and `rejected` are creation states and are never copied here. `pending` only means a\ndevolución the gateway accepted and has not confirmed."
                    },
                    "paymentStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "The estado de pago of the order now: `refunded` once the devoluciones succeeded add up to it, otherwise `paid`."
                    },
                    "description": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "description": "What the public API says about a devolución."
                }
              }
            }
          },
          "201": {
            "description": "Primera creación de devolución confirmada.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "Location": {
                "description": "Ruta del recurso persistido para seguimiento.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string",
                      "description": "The número de orden of the order refunded."
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "What is refunded, in decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "refundType": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "`total` or `partial`."
                    },
                    "creationStatus": {
                      "type": "string",
                      "description": "CreationStatuses: creating, created, rejected or unknown (ADR-0041): whether the gateway has the devolución, apart from its result."
                    },
                    "refundStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "The result of the devolución itself (`pending`, `succeeded`, `failed`), or null while there is no acceptance nor a\nreliable result: `unknown` and `rejected` are creation states and are never copied here. `pending` only means a\ndevolución the gateway accepted and has not confirmed."
                    },
                    "paymentStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "The estado de pago of the order now: `refunded` once the devoluciones succeeded add up to it, otherwise `paid`."
                    },
                    "description": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "description": "What the public API says about a devolución."
                }
              }
            }
          },
          "202": {
            "description": "creationStatus creating o unknown y refundStatus null; recurso local persistido, consulte su estado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "Location": {
                "description": "Ruta del recurso persistido para seguimiento.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus",
                    "refundStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string",
                      "description": "The número de orden of the order refunded."
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "What is refunded, in decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "refundType": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "`total` or `partial`."
                    },
                    "creationStatus": {
                      "enum": [
                        "creating",
                        "unknown"
                      ],
                      "type": "string"
                    },
                    "refundStatus": {
                      "type": "null"
                    },
                    "paymentStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "The estado de pago of the order now: `refunded` once the devoluciones succeeded add up to it, otherwise `paid`."
                    },
                    "description": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "JSON mal formado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "401": {
            "description": "No autenticado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "description": "Desafío de autenticación, cuando corresponda.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "403": {
            "description": "Sin permiso o acceso al recurso.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "503": {
            "description": "service_unavailable: estado no confirmado; consulte o repita la misma solicitud con la misma Idempotency-Key.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "404": {
            "description": "Recurso no encontrado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "409": {
            "description": "Conflicto con el estado o la identidad de la solicitud.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "422": {
            "description": "Solicitud inválida, operación no soportada o rechazo de pasarela; puede incluir el recurso rechazado conservado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    },
                    "resource": {
                      "required": [
                        "id",
                        "reference",
                        "creationStatus"
                      ],
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "reference": {
                          "type": "string",
                          "description": "The número de orden of the order refunded."
                        },
                        "gateway": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "amount": {
                          "type": "number",
                          "description": "What is refunded, in decimals (ADR-0025).",
                          "format": "double"
                        },
                        "currency": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "refundType": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "description": "`total` or `partial`."
                        },
                        "creationStatus": {
                          "type": "string",
                          "description": "CreationStatuses: creating, created, rejected or unknown (ADR-0041): whether the gateway has the devolución, apart from its result."
                        },
                        "refundStatus": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "description": "The result of the devolución itself (`pending`, `succeeded`, `failed`), or null while there is no acceptance nor a\nreliable result: `unknown` and `rejected` are creation states and are never copied here. `pending` only means a\ndevolución the gateway accepted and has not confirmed."
                        },
                        "paymentStatus": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "description": "The estado de pago of the order now: `refunded` once the devoluciones succeeded add up to it, otherwise `paid`."
                        },
                        "description": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "description": "What the public API says about a devolución."
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "refunds:write"
            ]
          }
        ]
      }
    },
    "/v1/payments/refund/{id}": {
      "get": {
        "tags": [
          "RefundEndpoints"
        ],
        "summary": "Consultar devolución",
        "description": "Requiere el permiso `refunds:read`. La autenticación y autorización preceden a la lectura del cuerpo JSON.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Recurso consultado o existente.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "id",
                    "reference",
                    "creationStatus"
                  ],
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string",
                      "description": "The número de orden of the order refunded."
                    },
                    "gateway": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "amount": {
                      "type": "number",
                      "description": "What is refunded, in decimals (ADR-0025).",
                      "format": "double"
                    },
                    "currency": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "refundType": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "`total` or `partial`."
                    },
                    "creationStatus": {
                      "type": "string",
                      "description": "CreationStatuses: creating, created, rejected or unknown (ADR-0041): whether the gateway has the devolución, apart from its result."
                    },
                    "refundStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "The result of the devolución itself (`pending`, `succeeded`, `failed`), or null while there is no acceptance nor a\nreliable result: `unknown` and `rejected` are creation states and are never copied here. `pending` only means a\ndevolución the gateway accepted and has not confirmed."
                    },
                    "paymentStatus": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "description": "The estado de pago of the order now: `refunded` once the devoluciones succeeded add up to it, otherwise `paid`."
                    },
                    "description": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "description": "What the public API says about a devolución."
                }
              }
            }
          },
          "401": {
            "description": "No autenticado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "description": "Desafío de autenticación, cuando corresponda.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "403": {
            "description": "Sin permiso o acceso al recurso.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "503": {
            "description": "service_unavailable: no se pudo consultar el estado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          },
          "404": {
            "description": "Recurso no encontrado.",
            "headers": {
              "API-Version": {
                "description": "Versión pública de la API: v1.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "required": [
                    "type",
                    "title",
                    "status",
                    "detail",
                    "code"
                  ],
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "title": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "status": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "detail": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "code": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "required": [
                          "code",
                          "detail"
                        ],
                        "type": "object",
                        "oneOf": [
                          {
                            "required": [
                              "pointer"
                            ]
                          },
                          {
                            "required": [
                              "header"
                            ]
                          }
                        ],
                        "properties": {
                          "code": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "pointer": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "header": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "detail": {
                            "type": [
                              "null",
                              "string"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "description": "Problem Details with Pagath's extensions; resource is present only when a local record was retained."
                }
              }
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "refunds:read"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "OAuth2": {
        "type": "oauth2",
        "description": "Client credentials. En Sandbox use https://auth-sandbox.pagath.cu/oauth/token.",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://auth.pagath.cu/oauth/token",
            "scopes": {
              "payments:read": "Consultar órdenes y pasarelas disponibles.",
              "payments:write": "Crear, completar y cancelar órdenes.",
              "refunds:read": "Consultar devoluciones.",
              "refunds:write": "Crear devoluciones."
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Pagath.Payments.Api"
    },
    {
      "name": "PaymentOrderEndpoints"
    },
    {
      "name": "RefundEndpoints"
    }
  ]
}