{"name":"site_subscriptions_plan_save","title":"Сохранить план подписки","section":"Подписки покупателей","mode":"write","url":"/tools/site_subscriptions_plan_save","blurb":"Создаёт новый план или сохраняет согласованные условия по ожидаемой ревизии.","aliases":"","kind":"Инструмент","examples":[{"label":"Рабочая задача","prompt":"Для выбранного плана подготовь обновление согласованной цены. Сначала покажи прежние условия, валюту и текущую ревизию.","check":"Создаёт новый план или сохраняет согласованные условия по ожидаемой ревизии."},{"label":"Подготовить запрос","prompt":"Помоги подготовить вызов site_subscriptions_plan_save для задачи «Сохранить план подписки». Разбери planId, expectedRevision, expectedLegacyRevision и покажи, откуда взять точные значения для выбранного объекта. Остановись на черновике запроса.","check":"Сверить значения со схемой до вызова."},{"label":"После сбоя","prompt":"При выполнении «Сохранить план подписки» связь прервалась после отправки. Для site_subscriptions_plan_save проверь исходный ключ операции и текущее состояние объекта перед решением о повторе.","check":"Сопоставить результат с исходной операцией."}],"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"planId":{"description":"planId","type":"string","pattern":"^[A-Za-z0-9_~:@+.-]{1,128}$"},"expectedRevision":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"expectedRevision"},"expectedLegacyRevision":{"description":"expectedLegacyRevision","type":"string","pattern":"^[a-f0-9]{64}$"},"values":{"type":"object","properties":{"kind":{"type":"string","enum":["products_services","company_platform"],"description":"kind"},"name":{"type":"string","minLength":1,"maxLength":160,"description":"name"},"description":{"default":"","description":"description","type":"string","maxLength":2000},"amountCents":{"type":"integer","exclusiveMinimum":0,"maximum":99999999,"description":"amountCents"},"currency":{"type":"string","pattern":"^[A-Z]{3}$","description":"currency"},"interval":{"type":"string","enum":["day","week","month","year"],"description":"interval"},"intervalCount":{"default":1,"description":"intervalCount","type":"integer","minimum":1,"maximum":12},"trialDays":{"default":0,"description":"trialDays","type":"integer","minimum":0,"maximum":730},"trialRequiresPaymentMethod":{"default":true,"description":"trialRequiresPaymentMethod","type":"boolean"},"allowCancel":{"default":true,"description":"allowCancel","type":"boolean"},"allowImmediateCancel":{"default":false,"description":"allowImmediateCancel","type":"boolean"},"allowResume":{"default":true,"description":"allowResume","type":"boolean"},"active":{"default":true,"description":"active","type":"boolean"},"productIds":{"default":[],"description":"productIds","maxItems":100,"type":"array","items":{"type":"string","pattern":"^[A-Za-z0-9_~:@+.-]{1,128}$","description":"Company catalog product or service ID."}},"platformKey":{"default":null,"description":"platformKey","anyOf":[{"type":"string","pattern":"^[a-z0-9][a-z0-9_.-]{0,79}$"},{"type":"null"}]},"autoAttach":{"default":true,"description":"autoAttach","type":"boolean"},"benefits":{"description":"benefits","type":"object","properties":{"currency":{"type":"string","pattern":"^[A-Z]{3}$","description":"Currency of subscriber product prices; may differ from the Stripe plan currency."},"productPrices":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","pattern":"^[A-Za-z0-9_~:@+.-]{1,128}$","description":"productId"},"priceMinor":{"type":"integer","minimum":0,"maximum":99999999,"description":"priceMinor"}},"required":["productId","priceMinor"],"additionalProperties":false},"description":"productPrices"},"variantPrices":{"description":"Subscriber prices for exact catalog variants. Provide the parent product, option set, and selected variant product. An empty list clears variant prices.","maxItems":100,"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","pattern":"^[A-Za-z0-9_~:@+.-]{1,128}$","description":"productId"},"optionSetId":{"type":"string","pattern":"^[A-Za-z0-9_~:@+.-]{1,128}$","description":"optionSetId"},"optionProductId":{"type":"string","pattern":"^[A-Za-z0-9_~:@+.-]{1,128}$","description":"optionProductId"},"priceMinor":{"type":"integer","minimum":0,"maximum":99999999,"description":"priceMinor"}},"required":["productId","optionSetId","optionProductId","priceMinor"],"additionalProperties":false}},"freeDelivery":{"type":"boolean","description":"freeDelivery"}},"required":["currency","productPrices","freeDelivery"],"additionalProperties":false},"recurringDelivery":{"description":"recurringDelivery","type":"boolean"},"deliveryPricing":{"description":"catalog uses regular catalog lines; plan_base replaces only the parent price and adds options. variant_discount discounts the parent plus one required pack together, before shipping and tax. Requires deliveryVariant and deliveryDiscountPercent.","type":"string","enum":["catalog","plan_base","variant_discount"]},"deliveryDiscountPercent":{"description":"Whole percent off the combined catalog price of the parent and one selected pack. Set amountCents to the net unit price rounded half up to cents. The server checks it on enrollment and retains the agreed price for renewals.","type":"integer","minimum":1,"maximum":99},"deliveryVariant":{"description":"Required exact native option for a physical delivery plan. Null clears the selection.","anyOf":[{"type":"object","properties":{"productId":{"type":"string","pattern":"^[A-Za-z0-9_~:@+.-]{1,128}$","description":"productId"},"optionSetId":{"type":"string","pattern":"^[A-Za-z0-9_~:@+.-]{1,128}$","description":"optionSetId"},"optionProductId":{"type":"string","pattern":"^[A-Za-z0-9_~:@+.-]{1,128}$","description":"optionProductId"}},"required":["productId","optionSetId","optionProductId"],"additionalProperties":false},{"type":"null"}]}},"required":["kind","name","description","amountCents","currency","interval","intervalCount","trialDays","trialRequiresPaymentMethod","allowCancel","allowImmediateCancel","allowResume","active","productIds","platformKey","autoAttach"],"additionalProperties":false,"description":"values"},"requestId":{"type":"string","pattern":"^[A-Za-z0-9_-]{8,128}$","description":"requestId"},"siteId":{"type":"string","pattern":"^[A-Za-z0-9_~:@+.-]{1,128}$"}},"required":["expectedRevision","values","requestId","siteId"],"additionalProperties":false},"outputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"},"$defs":{"__schema0":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/$defs/__schema0"}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"$ref":"#/$defs/__schema0"}}]}}}}