{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nmi/json-schema/nmi-payment-request-status-response-schema.json",
  "title": "Payment Request Status Response",
  "description": "Payment request response. Returned when creating an asynchronous payment request or polling for its status.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nmi-devices-api-openapi.yml#/components/schemas/PaymentRequestStatusResponse",
  "type": "object",
  "properties": {
    "object": {
      "type": "string",
      "enum": [
        "payment-request"
      ],
      "description": "Resource type identifier"
    },
    "id": {
      "type": "string",
      "description": "Payment request ID"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "inFlight",
        "interactionComplete",
        "cancelled",
        "cancelledAtTerminal",
        "cancelledByApi",
        "cancelledByTimeout",
        "poiDeviceInUse",
        "poiDeviceDisconnected",
        "terminatedBadCardRead"
      ],
      "description": "Status of the payment request. When a payment request is first created, the status is always `pending`. When polling for status, values are more granular to show the progress of the transaction based on the device's status or customer's interaction."
    },
    "transaction": {
      "type": "object",
      "description": "Transaction details if the payment request has been processed",
      "properties": {
        "id": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Transaction ID"
        },
        "type": {
          "type": "string",
          "description": "Transaction type (e.g., 'sale', 'auth', 'credit', 'validate')"
        },
        "success": {
          "type": "boolean",
          "description": "Whether the transaction was successful"
        },
        "condition": {
          "type": "string",
          "description": "Transaction condition/status"
        },
        "approval": {
          "type": "string",
          "description": "Approval code"
        },
        "authorized_amount": {
          "type": "string",
          "description": "Authorized amount. Format: `x.xx`"
        },
        "auth_code": {
          "type": "string",
          "description": "Authorization code"
        },
        "customer_vault_id": {
          "type": "string",
          "description": "Customer vault ID associated with the transaction"
        },
        "emv_metadata": {
          "type": "object",
          "description": "EMV (chip card) metadata",
          "properties": {
            "customer_verification_method": {
              "type": "string",
              "description": "Customer verification method used"
            },
            "application_id": {
              "type": "string",
              "description": "EMV application ID"
            },
            "application_label": {
              "type": "string",
              "description": "EMV application label"
            },
            "application_preferred_name": {
              "type": "string",
              "description": "EMV application preferred name"
            },
            "application_pan_sequence_number": {
              "type": "string",
              "description": "EMV application PAN sequence number"
            },
            "transaction_status_information": {
              "type": "string",
              "description": "EMV transaction status information"
            },
            "masked_merchant_number": {
              "type": "string",
              "description": "Masked merchant number"
            },
            "masked_terminal_number": {
              "type": "string",
              "description": "Masked terminal number"
            }
          }
        },
        "card_tokens": {
          "type": "array",
          "description": "Card tokens associated with the transaction",
          "items": {
            "type": "object",
            "properties": {
              "token": {
                "type": "string",
                "description": "Card token"
              },
              "type": {
                "type": "string",
                "description": "Token type"
              }
            }
          }
        }
      }
    },
    "error": {
      "type": "object",
      "description": "Error information if the payment request failed",
      "properties": {
        "code": {
          "type": "string",
          "description": "Error code"
        },
        "ref_id": {
          "type": "string",
          "description": "Error reference ID"
        },
        "message": {
          "type": "string",
          "description": "Error message"
        }
      }
    }
  },
  "required": [
    "object",
    "id",
    "status"
  ]
}