{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/recurly/json-schema/recurly-subscription-create-request-dto-schema.json",
  "title": "SubscriptionCreateRequestDTO",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/recurly-commerce-openapi.yml#/components/schemas/SubscriptionCreateRequestDTO",
  "type": "object",
  "properties": {
    "deliveryCadenceCount": {
      "type": "number"
    },
    "deliveryCadenceUnit": {
      "type": "string",
      "enum": [
        "HOUR",
        "DAY",
        "MONTH",
        "WEEK",
        "YEAR"
      ]
    },
    "billingCadenceCount": {
      "type": "number"
    },
    "billingCadenceUnit": {
      "type": "string",
      "enum": [
        "HOUR",
        "DAY",
        "MONTH",
        "WEEK",
        "YEAR"
      ]
    },
    "customAttributes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CustomAttribute"
      }
    },
    "subscriberId": {
      "type": "string"
    },
    "subscriptionOfferId": {
      "type": "string",
      "description": "The internal id of the subscription plan (subscription offer) this subscription belongs to. Every line must belong to this plan."
    },
    "deliveryFirstName": {
      "type": "string",
      "description": "Required unless the subscription plan is digital-only (no shipping needed)."
    },
    "deliveryLastName": {
      "type": "string",
      "description": "Required unless the subscription plan is digital-only (no shipping needed)."
    },
    "deliveryAddress1": {
      "type": "string",
      "description": "Required unless the subscription plan is digital-only (no shipping needed)."
    },
    "deliveryAddress2": {
      "type": [
        "string",
        "null"
      ]
    },
    "deliveryCountry": {
      "type": "string",
      "description": "Required unless the subscription plan is digital-only (no shipping needed)."
    },
    "deliveryCountryCode": {
      "type": "string"
    },
    "deliveryProvince": {
      "type": [
        "string",
        "null"
      ]
    },
    "deliveryProvinceCode": {
      "type": "string"
    },
    "deliveryCity": {
      "type": "string",
      "description": "Required unless the subscription plan is digital-only (no shipping needed)."
    },
    "deliveryZip": {
      "type": "string",
      "description": "Required unless the subscription plan is digital-only (no shipping needed)."
    },
    "deliveryPhone": {
      "type": "string",
      "description": "The delivery phone number. Required unless the subscription plan is digital-only."
    },
    "deliveryCompany": {
      "type": [
        "string",
        "null"
      ]
    },
    "paymentMethodExternalId": {
      "type": "string",
      "description": "The shopify payment method ID"
    },
    "lines": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SubscriptionLineCreateThroughContractRequestDto"
      }
    },
    "discountCode": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "deliveryCadenceCount",
    "deliveryCadenceUnit",
    "billingCadenceCount",
    "billingCadenceUnit",
    "subscriberId",
    "subscriptionOfferId",
    "paymentMethodExternalId",
    "lines"
  ],
  "$defs": {
    "CustomAttribute": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "key",
        "value"
      ]
    },
    "SubscriptionLineCreateThroughContractRequestDto": {
      "type": "object",
      "properties": {
        "variantId": {
          "type": "string"
        },
        "quantity": {
          "type": "number"
        },
        "currentPrice": {
          "type": "number",
          "description": "The price of the variant before the subscription discount. Only use if you want to override the default price of the variant."
        },
        "sellingPlanId": {
          "type": "string",
          "description": "The shopify selling plan ID of the subscription offer option. The configured discount will be used to calculated the amount of the line."
        },
        "customAttributes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CustomAttribute"
          }
        }
      },
      "required": [
        "variantId",
        "quantity",
        "sellingPlanId"
      ]
    }
  }
}