{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://comercioia.cl/ucp/handlers/webpay_plus/2026-10-09.json",
  "name": "cl.comercioia.webpay_plus",
  "version": "2026-10-09",
  "title": "Webpay Plus (Transbank) payment handler",
  "description": "OPEN PROPOSAL, ready to implement and open for comment. Not yet stable. Redirect payment. The business creates the transaction with its own Transbank commerce code; Webpay Plus requires an HTML form POST of token_ws, so continue_url points to a business page that auto-posts it. Confirmation is by commit on return (approved only when response_code = 0 and status = AUTHORIZED); there is no webhook, so businesses MUST sweep abandoned transactions by status query. Funds go from the buyer to the business's own Transbank account and never pass through the handler author. Published by the Comercio IA initiative until Transbank publishes its own handler; Transbank is invited to review, co-sign or take it over. Not affiliated with or endorsed by Transbank. Spec: https://comercioia.cl/spec/#webpay-plus",
  "$defs": {
    "cl.comercioia.webpay_plus": {
      "payment_instrument": {
        "allOf": [
          {
            "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/payment_instrument.json"
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "redirect"
              }
            }
          }
        ]
      },
      "business_schema": {
        "allOf": [
          {
            "$ref": "https://ucp.dev/2026-08-25/schemas/payment_handler.json#/$defs/business_schema"
          },
          {
            "type": "object",
            "properties": {
              "config": {
                "$ref": "#/$defs/business_config"
              }
            }
          }
        ]
      },
      "platform_schema": {
        "allOf": [
          {
            "$ref": "https://ucp.dev/2026-08-25/schemas/payment_handler.json#/$defs/platform_schema"
          },
          {
            "type": "object",
            "properties": {
              "config": {
                "$ref": "#/$defs/platform_config"
              }
            }
          }
        ]
      },
      "response_schema": {
        "allOf": [
          {
            "$ref": "https://ucp.dev/2026-08-25/schemas/payment_handler.json#/$defs/response_schema"
          },
          {
            "type": "object",
            "properties": {
              "config": {
                "$ref": "#/$defs/response_config"
              }
            }
          }
        ]
      }
    },
    "business_config": {
      "type": "object",
      "description": "Public configuration only. Credentials and API keys MUST NOT appear in profiles or responses.",
      "properties": {
        "environment": {
          "type": "string",
          "examples": [
            "production",
            "integration"
          ]
        }
      }
    },
    "platform_config": {
      "type": "object",
      "description": "No platform configuration is required: the platform only follows continue_url."
    },
    "response_config": {
      "type": "object",
      "properties": {
        "environment": {
          "type": "string",
          "examples": [
            "production",
            "integration"
          ]
        },
        "token_ttl_seconds": {
          "type": "integer",
          "examples": [
            300
          ],
          "description": "Lifetime of the Webpay token."
        },
        "payment_window_seconds": {
          "type": "integer",
          "examples": [
            240
          ],
          "description": "Time the buyer has on the Webpay form in production."
        }
      }
    }
  }
}
