{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://shopify.dev/ucp/shop-pay-handler/2026-08-25/shop_pay.json",
  "title": "Shop Pay Payment Instrument",
  "description": "Payment instrument structure for Shop Pay. Extends the base payment instrument with the Shop Token credential and display rendered by Shop Pay: a description, the buyer's funding instruments, and, for a delegated budget, its spend limit.",
  "$defs": {
    "available_instrument": {
      "title": "Available Shop Pay Instrument",
      "description": "An `available_instruments[]` entry for the Shop Pay handler: the one instrument type, `shop_pay`.",
      "allOf": [
        {
          "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/available_payment_instrument.json"
        }
      ],
      "type": "object",
      "properties": {
        "type": {
          "const": "shop_pay"
        }
      }
    },
    "funding_instrument": {
      "title": "Shop Pay Funding Instrument",
      "description": "A buyer funding source behind a Shop Pay instrument: a card, the buyer's Shop Cash, or Shop Pay Installments. Its presentation is in `display`.",
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The funding source: `card`, `shop_cash`, or `installments`.",
          "examples": [
            "card",
            "shop_cash",
            "installments"
          ]
        },
        "display": {
          "type": "object",
          "properties": {
            "description": {
              "type": "string",
              "description": "Buyer-facing label for this funding source, rendered by Shop Pay, for example `Travel card \u2022\u2022\u2022\u2022 1314` or `Shop Cash`. Do not parse; its format may change."
            }
          }
        }
      },
      "if": {
        "properties": {
          "type": {
            "const": "card"
          }
        }
      },
      "then": {
        "properties": {
          "display": {
            "allOf": [
              {
                "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/card_payment_instrument.json#/allOf/1/properties/display"
              },
              {
                "type": "object",
                "properties": {
                  "issuer": {
                    "type": "string",
                    "description": "The card's issuing bank as Shop Pay displays it, for example `Chase`. Omitted when unknown."
                  },
                  "nickname": {
                    "type": "string",
                    "description": "The name the buyer gave this card in Shop. Omitted when unset."
                  }
                }
              }
            ]
          }
        }
      }
    }
  },
  "allOf": [
    {
      "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/payment_instrument.json"
    }
  ],
  "type": "object",
  "properties": {
    "type": {
      "const": "shop_pay",
      "description": "The payment instrument type identifier for Shop Pay."
    },
    "credential": {
      "$ref": "https://shopify.dev/ucp/shop-pay-handler/2026-08-25/shop_token.json"
    },
    "display": {
      "type": "object",
      "description": "Display information for this Shop Pay instrument, rendered by Shop Pay. Platforms do not send display; a business ignores display on submitted instruments.",
      "properties": {
        "description": {
          "type": "string",
          "description": "Buyer-facing label for the whole payment choice, suitable for rendering as-is when funding instruments are not enumerated. Equal to the funding instrument's description when there is one; composed when there are several. Do not parse; its format may change."
        },
        "funding_instruments": {
          "type": "array",
          "description": "The buyer's funding sources behind this instrument, in Shop Pay's order.",
          "items": {
            "$ref": "#/$defs/funding_instrument"
          }
        },
        "remaining_amount": {
          "type": "integer",
          "minimum": 0,
          "description": "Delegated budget only. The amount remaining in the current period, in the checkout's currency minor units."
        },
        "limit": {
          "type": "integer",
          "minimum": 0,
          "description": "Delegated budget only. The spending limit for the current period, in the checkout's currency minor units."
        },
        "renewal_type": {
          "type": "string",
          "enum": [
            "monthly"
          ],
          "description": "Delegated budget only. How the limit renews."
        },
        "renews_at": {
          "type": "string",
          "format": "date-time",
          "description": "Delegated budget only. When the limit next renews."
        }
      }
    }
  }
}
