{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/paytrail/json-schema/paytrail-payment-request-response-schema.json",
  "title": "PaymentRequestResponse",
  "description": "Response for a successful payment request. Mechant ecom site can then either redirect\nthe user to the URL given in href, or render the payment provider forms onsite. For\neach payment method an HTML form needs to be rendered using the parameters returned\nfor each payment method provider.\n",
  "x-generated": "2026-11-16",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/paytrail-openapi.yml#/components/schemas/PaymentRequestResponse",
  "type": "object",
  "required": [
    "transactionId",
    "href",
    "paymentMethods"
  ],
  "properties": {
    "transactionId": {
      "type": "string",
      "format": "uuid",
      "description": "Checkout assigned transaction ID for the payment."
    },
    "href": {
      "type": "string",
      "format": "url",
      "description": "Unique URL to hosted payment gateway"
    },
    "terms": {
      "type": "string",
      "description": "Text containing a link to the terms of payment"
    },
    "groups": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PaymentMethodGroupData"
      },
      "description": "Contains data about the payment method groups. Contains only the groups found in the response's providers."
    },
    "providers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PaymentMethodProvider"
      }
    }
  },
  "$defs": {
    "BasePaymentMethodProvider": {
      "type": "object",
      "required": [
        "id",
        "name",
        "icon",
        "group",
        "svg"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the provider"
        },
        "name": {
          "type": "string",
          "description": "Display name of the payment method"
        },
        "svg": {
          "type": "string",
          "format": "url",
          "description": "URL to payment method SVG icon (recommended to be used instead if PNG)"
        },
        "icon": {
          "type": "string",
          "format": "url",
          "description": "URL to payment method PNG icon"
        },
        "group": {
          "type": "string",
          "enum": [
            "mobile",
            "bank",
            "creditcard",
            "credit"
          ]
        }
      }
    },
    "PaymentMethodGroupData": {
      "type": "object",
      "description": "ID, name and icon URLs for a payment method group",
      "required": [
        "id",
        "name",
        "icon",
        "svg"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the group",
          "enum": [
            "mobile",
            "bank",
            "creditcard",
            "credit"
          ]
        },
        "name": {
          "type": "string",
          "description": "Localized name of the group"
        },
        "icon": {
          "type": "string",
          "format": "url",
          "description": "URL to the group PNG icon"
        },
        "svg": {
          "type": "string",
          "format": "url",
          "description": "URL to the group SVG icon (recommended to be used instead if PNG)"
        }
      }
    },
    "PaymentMethodProvider": {
      "allOf": [
        {
          "$ref": "#/$defs/BasePaymentMethodProvider"
        },
        {
          "description": "Each payment method provider object describes an HTML form. The payment method parameters need to be posted to defined url in application/x-www-form-urlencoded format."
        },
        {
          "required": [
            "name",
            "icon",
            "url",
            "group",
            "svg",
            "parameters"
          ],
          "properties": {
            "url": {
              "type": "string",
              "format": "url",
              "description": "Form action url"
            },
            "parameters": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "name",
                  "value"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Name of the form input"
                  },
                  "value": {
                    "type": "string",
                    "description": "Value of the form input"
                  }
                }
              }
            }
          }
        }
      ]
    }
  }
}