{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/assembly-payments/main/json-schema/assembly-payments-payment-data-schema.json",
  "title": "paymentData",
  "x-generated": "2026-10-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/assembly-payments-supplementary-data-apis-api-openapi.yml#/components/schemas/paymentData",
  "allOf": [
    {
      "$ref": "#/$defs/base"
    },
    {
      "type": "object",
      "properties": {
        "error_message": {
          "type": "string",
          "description": "Explanation why payment failed! Only available for PayTo Payments",
          "enum": [
            "Payment reconciliation failed on the user's wallet as the agreement associated with it is not active",
            "Payment reconciliation failed on the user's wallet as the payment initiation request associated is in invalid status",
            "Payment reconciliation failed on the user's wallet as the payment initiation request associated does not exist",
            "Payment reconciliation failed on the user's wallet as the payment initiation request provided does not match with the payment initiation request associated with the agreement",
            "Payment reconciliation failed on the user's wallet as PayTo feature is disabled for your platform. Please contact Zai support.",
            "Payment reconciliation failed on the user's wallet due to some technical error. Please contact Zai support."
          ]
        },
        "npp_details": {
          "type": "object",
          "$ref": "#/$defs/nppDetails"
        },
        "links": {
          "type": "object",
          "$ref": "#/$defs/linksNpp"
        }
      }
    }
  ],
  "$defs": {
    "base": {
      "type": "object",
      "required": [
        "id",
        "debtor_name",
        "debtor_bsb",
        "debtor_account",
        "creditor_account",
        "creditor_name",
        "remittance_information",
        "type",
        "type_method"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "debtor_name": {
          "type": "string"
        },
        "debtor_bsb": {
          "type": "string"
        },
        "debtor_account": {
          "type": "string"
        },
        "creditor_account": {
          "type": "string"
        },
        "creditor_name": {
          "type": "string"
        },
        "remittance_information": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "type_method": {
          "type": "string"
        }
      }
    },
    "linksNpp": {
      "type": "object",
      "required": [
        "self",
        "agreements"
      ],
      "properties": {
        "self": {
          "type": "string"
        },
        "agreements": {
          "type": "string"
        }
      }
    },
    "nppDetails": {
      "description": "Details for the NPP payment. `npp_details` will only be present when `type_method` is `npp_payin`",
      "type": "object",
      "required": [
        "pay_id",
        "pay_id_type",
        "clearing_system_transaction_id",
        "end_to_end_id",
        "npp_payin_internal_id",
        "cdtr_ref_inf",
        "ultm_cdtr_id",
        "ultmt_cdtr_schme_nm",
        "ctgy_purp",
        "debtor_legal_name"
      ],
      "properties": {
        "pay_id": {
          "type": "string"
        },
        "pay_id_type": {
          "type": "string"
        },
        "clearing_system_transaction_id": {
          "type": "string"
        },
        "end_to_end_id": {
          "type": "string"
        },
        "cdtr_ref_inf": {
          "type": "string"
        },
        "ultm_cdtr_id": {
          "type": "string"
        },
        "ultmt_cdtr_schme_nm": {
          "type": "string"
        },
        "ultm_cdtr_nm": {
          "type": "string",
          "minLength": 0,
          "maxLength": 140
        },
        "ctgy_purp": {
          "type": "string"
        },
        "debtor_legal_name": {
          "type": "string"
        },
        "instruction_id": {
          "type": "string",
          "maxLength": 35,
          "minLength": 1,
          "description": "Unique identifier for the payment request generated as per NPPA guidelines. Only available for PayTo Payments"
        },
        "agreement_id": {
          "type": "string",
          "description": "Unique agreement identifier generated by NPPA. Only available for PayTo Payments"
        },
        "agreement_uuid": {
          "type": "string",
          "description": "Unique agreement identifier generated by Zai. Only available for PayTo Payments",
          "format": "uuid"
        }
      }
    }
  }
}