{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/SubscriptionPurchaseV2",
  "title": "SubscriptionPurchaseV2",
  "type": "object",
  "description": "Indicates the v2 subscription purchase details, including subscription state, line items, and external account information.",
  "properties": {
    "kind": {
      "type": "string",
      "description": "Resource type identifier.",
      "const": "androidpublisher#subscriptionPurchaseV2",
      "example": "example_value"
    },
    "regionCode": {
      "type": "string",
      "description": "ISO 3166-1 alpha-2 billing region code.",
      "example": "example_value"
    },
    "latestOrderId": {
      "type": "string",
      "description": "The order ID of the latest order associated with this subscription.",
      "example": "500123"
    },
    "lineItems": {
      "type": "array",
      "description": "Item-level info for a subscription purchase. Each line item corresponds to a base plan or offer.",
      "items": {
        "$ref": "#/components/schemas/SubscriptionPurchaseLineItem"
      },
      "example": []
    },
    "startTime": {
      "type": "string",
      "format": "date-time",
      "description": "Time at which the subscription was granted.",
      "example": "2026-01-15T10:30:00Z"
    },
    "subscriptionState": {
      "type": "string",
      "description": "The current state of the subscription.",
      "enum": [
        "SUBSCRIPTION_STATE_UNSPECIFIED",
        "SUBSCRIPTION_STATE_PENDING",
        "SUBSCRIPTION_STATE_ACTIVE",
        "SUBSCRIPTION_STATE_PAUSED",
        "SUBSCRIPTION_STATE_IN_GRACE_PERIOD",
        "SUBSCRIPTION_STATE_ON_HOLD",
        "SUBSCRIPTION_STATE_CANCELED",
        "SUBSCRIPTION_STATE_EXPIRED",
        "SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED"
      ],
      "example": "SUBSCRIPTION_STATE_UNSPECIFIED"
    },
    "linkedPurchaseToken": {
      "type": "string",
      "description": "The purchase token of the old subscription if replaced.",
      "example": "example_value"
    },
    "pausedStateContext": {
      "type": "object",
      "description": "Additional context around paused subscriptions.",
      "properties": {
        "autoResumeTime": {
          "type": "string",
          "format": "date-time",
          "description": "Time at which the subscription will auto-resume."
        }
      },
      "example": "example_value"
    },
    "canceledStateContext": {
      "type": "object",
      "description": "Additional context around canceled subscriptions.",
      "properties": {
        "userInitiatedCancellation": {
          "type": "object",
          "properties": {
            "finishTime": {
              "type": "string",
              "format": "date-time"
            }
          }
        },
        "systemInitiatedCancellation": {
          "type": "object"
        },
        "developerInitiatedCancellation": {
          "type": "object"
        },
        "replacementCancellation": {
          "type": "object"
        }
      },
      "example": "example_value"
    },
    "acknowledgementState": {
      "type": "string",
      "description": "The acknowledgement state of the subscription.",
      "enum": [
        "ACKNOWLEDGEMENT_STATE_UNSPECIFIED",
        "ACKNOWLEDGEMENT_STATE_PENDING",
        "ACKNOWLEDGEMENT_STATE_ACKNOWLEDGED"
      ],
      "example": "ACKNOWLEDGEMENT_STATE_UNSPECIFIED"
    },
    "externalAccountIdentifiers": {
      "type": "object",
      "description": "User account identification in third-party services.",
      "properties": {
        "externalAccountId": {
          "type": "string"
        },
        "obfuscatedExternalAccountId": {
          "type": "string"
        },
        "obfuscatedExternalProfileId": {
          "type": "string"
        }
      },
      "example": "example_value"
    }
  }
}