{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "SubscriptionPurchase",
  "type": "object",
  "description": "Represents a subscription purchase. Contains the subscription state, expiry time, auto-renewal status, and cancellation details.",
  "properties": {
    "kind": {
      "type": "string",
      "description": "Resource type identifier."
    },
    "startTimeMillis": {
      "type": "string",
      "description": "Time at which the subscription was granted (milliseconds since Epoch)."
    },
    "expiryTimeMillis": {
      "type": "string",
      "description": "Time at which the subscription will expire (milliseconds since Epoch). For cancelled subscriptions, this is when access ends."
    },
    "userCancellationTimeMillis": {
      "type": "string",
      "description": "Time at which the subscription was canceled by the user (milliseconds since Epoch). Only present if cancelReason is 0."
    },
    "autoRenewing": {
      "type": "boolean",
      "description": "Whether the subscription will automatically be renewed."
    },
    "priceCurrencyCode": {
      "type": "string",
      "description": "ISO 4217 currency code for the subscription price."
    },
    "priceAmountMicros": {
      "type": "string",
      "description": "Price of the subscription in micro-units of the currency. For example, 7990000 represents $7.99."
    },
    "countryCode": {
      "type": "string",
      "description": "ISO 3166-1 alpha-2 country code of the user at the time the subscription was granted."
    },
    "developerPayload": {
      "type": "string",
      "description": "Developer-specified string for additional information."
    },
    "paymentState": {
      "type": "integer",
      "description": "The payment state of the subscription. 0 = Payment pending, 1 = Payment received, 2 = Free trial, 3 = Pending deferred upgrade/downgrade."
    },
    "cancelReason": {
      "type": "integer",
      "description": "The reason a subscription was cancelled or not auto-renewed. 0 = User cancelled, 1 = System cancelled (billing issue), 2 = Replaced with a new subscription, 3 = Developer cancelled."
    },
    "linkedPurchaseToken": {
      "type": "string",
      "description": "The purchase token of the previous subscription if this subscription is a replacement (upgrade/downgrade)."
    },
    "purchaseType": {
      "type": "integer",
      "description": "The type of purchase. 0 = Test (sandbox), 1 = Promo."
    },
    "orderId": {
      "type": "string",
      "description": "The order ID of the latest recurring order."
    },
    "acknowledgementState": {
      "type": "integer",
      "description": "The acknowledgement state. 0 = Yet to be acknowledged, 1 = Acknowledged."
    },
    "externalAccountId": {
      "type": "string",
      "description": "User account identifier in the third-party service."
    },
    "promotionType": {
      "type": "integer",
      "description": "The type of promotion applied on this purchase. 0 = One-time code, 1 = Vanity code."
    },
    "promotionCode": {
      "type": "string",
      "description": "The promotion code applied on this purchase."
    },
    "obfuscatedExternalAccountId": {
      "type": "string",
      "description": "Obfuscated user account ID in the third-party service."
    },
    "obfuscatedExternalProfileId": {
      "type": "string",
      "description": "Obfuscated user profile ID in the third-party service."
    }
  }
}