{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/woolworths-group/main/json-schema/woolworths-group-merchant-api-application-queries-view-models-merchant-session-view-model-schema.json",
  "title": "Merchant.API.Application.Queries.ViewModels.MerchantSessionViewModel",
  "x-generated": "2026-10-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/woolworths-group-wpay-payto-merchant-openapi.yml#/components/schemas/Merchant.API.Application.Queries.ViewModels.MerchantSessionViewModel",
  "required": [
    "buyer",
    "merchantId",
    "merchantReturnUrl",
    "sessionCreatedTimestamp",
    "sessionExpiryTimestamp",
    "sessionId",
    "sessionStatus",
    "sessionType",
    "sessionUpdatedTimestamp",
    "wpayRedirectionUrl"
  ],
  "type": "object",
  "properties": {
    "sessionId": {
      "minLength": 1,
      "type": "string",
      "description": "ID of the session that was created.<br/>Note: Wpay uses the UUID v4 format for all the unique IDs we generate."
    },
    "merchantId": {
      "minLength": 1,
      "type": "string",
      "description": "ID of the merchant."
    },
    "sessionType": {
      "$ref": "#/$defs/Merchant.Domain.Enums.SessionType"
    },
    "merchantReturnUrl": {
      "minLength": 1,
      "type": "string",
      "description": "The Merchant's supplied return URL where Wpay will re-direct the consumer once they are done."
    },
    "wpayRedirectionUrl": {
      "minLength": 1,
      "type": "string",
      "description": "The Wpay URL where merchant is required to re-direct the consumer immediately upon receipt of this 201 created session response.<br/>Note: the re-direct launches the corresponding Wpay PayTo customer experience."
    },
    "buyer": {
      "$ref": "#/$defs/Merchant.API.Application.Queries.ViewModels.SessionDetails.BuyerViewModel"
    },
    "instrument": {
      "$ref": "#/$defs/Merchant.API.Application.Queries.ViewModels.SessionDetails.InstrumentViewModel"
    },
    "payment": {
      "$ref": "#/$defs/Merchant.API.Application.Queries.ViewModels.SessionDetails.PaymentViewModel"
    },
    "sessionCreatedTimestamp": {
      "type": "string",
      "description": "The date and time stamp when this session was created.",
      "format": "date-time"
    },
    "sessionUpdatedTimestamp": {
      "type": "string",
      "description": "The date and time stamp when this session was last updated.",
      "format": "date-time"
    },
    "sessionExpiryTimestamp": {
      "type": "string",
      "description": "The date and time stamp when this session expires.<br/>Note: typical Wpay session timer is 60 minutes.",
      "format": "date-time"
    },
    "sessionStatus": {
      "$ref": "#/$defs/Merchant.Domain.Enums.SessionStatus"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "Merchant.API.Application.Queries.ViewModels.SessionDetails.BuyerViewModel": {
      "required": [
        "buyerName"
      ],
      "type": "object",
      "properties": {
        "buyerId": {
          "type": [
            "string",
            "null"
          ],
          "description": "ID of the buyer for whom this session was created."
        },
        "buyerName": {
          "minLength": 1,
          "type": "string",
          "description": "The buyer or shopper full name as it is known to the merchant."
        }
      },
      "additionalProperties": false,
      "description": "This object contains the buyer details."
    },
    "Merchant.API.Application.Queries.ViewModels.SessionDetails.InstrumentViewModel": {
      "required": [
        "instrumentId",
        "instrumentType",
        "status"
      ],
      "type": "object",
      "properties": {
        "instrumentId": {
          "minLength": 1,
          "type": "string",
          "description": "The Merchant's unique PayTo instrument identifier."
        },
        "instrumentType": {
          "$ref": "#/$defs/Merchant.Domain.Enums.InstrumentType"
        },
        "status": {
          "$ref": "#/$defs/Merchant.Domain.Enums.InstrumentStatus"
        },
        "merchantWebhooksUrl": {
          "type": [
            "string",
            "null"
          ],
          "description": "The Merchant's supplied URL that should receive webhooks for the PayTo instrument created in this session."
        },
        "merchantDefinedData": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          },
          "description": "An optional object for passing any additional key-value pairs that might be useful to the merchant."
        }
      },
      "additionalProperties": false,
      "description": "This object contains the PayTo instrument details."
    },
    "Merchant.API.Application.Queries.ViewModels.SessionDetails.PaymentViewModel": {
      "required": [
        "amount",
        "instrumentId",
        "paymentId",
        "status"
      ],
      "type": "object",
      "properties": {
        "paymentId": {
          "minLength": 1,
          "type": "string",
          "description": "The Merchant's unique payment identifier."
        },
        "instrumentId": {
          "minLength": 1,
          "type": "string",
          "description": "ID of the PayTo instrument under which this payment was requested to be initiated."
        },
        "amount": {
          "type": "integer",
          "description": "Payment amount in cents. Value must be greater than zero.",
          "format": "int32"
        },
        "status": {
          "$ref": "#/$defs/Merchant.Domain.Enums.PaymentStatus"
        },
        "reference": {
          "type": [
            "string",
            "null"
          ],
          "description": "The order or purchase or reference number that is provided to consumer during checkout.<br/>Note: this value will be visible to consumers in their banking statements."
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Additional free form payment description that can be included for the consumer in the payment.<br/>Note: this value will be visible to consumers in their banking statements."
        },
        "creditorReference": {
          "type": [
            "string",
            "null"
          ],
          "description": "A backoffice only reference that can be used to aid in creditor's reconciliation activities.<br/>Note: this value will only be visible in creditor's corporate banking statement."
        },
        "merchantWebhooksUrl": {
          "type": [
            "string",
            "null"
          ],
          "description": "The Merchant's supplied URL that should receive webhooks for this payment."
        },
        "merchantDefinedData": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          },
          "description": "An optional object for passing any additional key-value pairs that might be useful to the merchant."
        }
      },
      "additionalProperties": false,
      "description": "This object contains the payment details."
    },
    "Merchant.Domain.Enums.InstrumentStatus": {
      "enum": [
        "NotStarted",
        "Pending",
        "Created",
        "Declined"
      ],
      "type": "string",
      "description": "The PayTo Instrument status in the context of this session."
    },
    "Merchant.Domain.Enums.InstrumentType": {
      "enum": [
        "OneOff",
        "Adhoc"
      ],
      "type": "string",
      "description": "The type of the PayTo instrument."
    },
    "Merchant.Domain.Enums.PaymentStatus": {
      "enum": [
        "NotStarted",
        "Processing",
        "Completed",
        "Rejected"
      ],
      "type": "string",
      "description": "The PayTo payment status in the context of this session."
    },
    "Merchant.Domain.Enums.SessionStatus": {
      "enum": [
        "Created",
        "Started",
        "Cancelled",
        "Completed",
        "Expired"
      ],
      "type": "string",
      "description": "The current status of this session."
    },
    "Merchant.Domain.Enums.SessionType": {
      "enum": [
        "Checkout",
        "Instrument",
        "Payment"
      ],
      "type": "string",
      "description": "The type of session that was created."
    }
  }
}