{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://objectsgrid.com/.well-known/objects-catalog/PayAction/v1/schema.json",
  "title": "PayAction",
  "description": "Objects Grid PayAction Object. One payment or refund a payment provider made, as the app records it from the provider's outcome: ObjectsGrid takes no payment and holds no card data. agent pays recipient: a refund is a PayAction the other way, with refundOf. Modeled in compliance with https://schema.org/PayAction. It has no JSON-LD document.",
  "x-objectsgrid-jsonLd": false,
  "type": "object",
  "properties": {
    "at_context": {
      "description": "Schema context",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "https://schema.org"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_type": {
      "description": "The object type",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "PayAction"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_id": {
      "description": "This PayAction's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>: its JSON-LD @id, which References point to. Set by the service.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "readOnly": true
    },
    "id": {
      "description": "The unique identifier for PayAction. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "identifier": {
      "description": "The unique identifier for PayAction. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "url": {
      "description": "This PayAction URL. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "minLength": 1,
      "readOnly": true
    },
    "object": {
      "description": "What it pays for",
      "x-objectsgrid-rangeIncludes": [
        "Order",
        "Invoice"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "agent": {
      "x-objectsgrid-erasure": "keep",
      "x-objectsgrid-version": "pinned",
      "description": "Who pays: the customer, or the shop for a refund; stored as <url>?version=<objectVersion>, as an Order's customer",
      "x-objectsgrid-rangeIncludes": [
        "Organization",
        "Person"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "recipient": {
      "x-objectsgrid-erasure": "keep",
      "description": "Who is paid: the shop, or the customer for a refund",
      "x-objectsgrid-rangeIncludes": [
        "Organization",
        "Person"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "price": {
      "description": "The amount",
      "type": "number",
      "minimum": 0
    },
    "priceCurrency": {
      "description": "The currency, an ISO 4217 code such as EUR",
      "type": "string",
      "pattern": "^[A-Z]{3}$"
    },
    "actionStatus": {
      "description": "Potential (created), Active (pending), Completed (paid) or Failed",
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ActionStatusType/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "description": "Why it failed, as the provider says",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 1000
    },
    "provider": {
      "x-objectsgrid-erasure": "keep",
      "description": "The payment provider, e.g. an Organization for Stripe",
      "x-objectsgrid-rangeIncludes": [
        "Organization"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "providerPaymentId": {
      "description": "The provider's id of the payment or refund, e.g. pi_3Q...: look it up to find the PayAction a webhook is about. ObjectsGrid's own field.",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 200
    },
    "instrument": {
      "description": "How it was paid, for display",
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/PaymentMethod/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "startTime": {
      "description": "When it started",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "endTime": {
      "description": "When it completed or failed",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "refundOf": {
      "description": "For a refund: the payment it refunds. ObjectsGrid's own field.",
      "x-objectsgrid-rangeIncludes": [
        "PayAction"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "description": {
      "description": "A note",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 1000
    },
    "tags": {
      "description": "Tags an ABAC policy can decide on. A name may repeat; the same name and value appear once. Every stored object has them: created empty when not sent, kept by a replacement (PUT) that does not mention them, unchanged by a patch that does not mention them, cleared by null or [].",
      "type": "array",
      "default": [],
      "uniqueItems": true,
      "maxItems": 50,
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Tag/v1/schema.json"
      }
    },
    "meta": {
      "description": "System-managed metadata for the object (version, audit fields). Assigned by the server.",
      "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ObjectMeta/v1/schema.json",
      "readOnly": true
    }
  },
  "required": [
    "object",
    "price",
    "priceCurrency"
  ],
  "unevaluatedProperties": false
}
