{"lexicon":1,"id":"money.atmosphere.catalog.createProduct","defs":{"main":{"type":"procedure","description":"Create an app-owned canonical ATM product in the calling app DID repo. Requires app service auth.","input":{"encoding":"application/json","schema":{"type":"object","required":["environment","title","kind","price"],"properties":{"environment":{"type":"string","knownValues":["test","live"],"maxLength":8},"title":{"type":"string","minLength":1,"maxGraphemes":100,"maxLength":1000},"sku":{"type":"string","maxLength":64},"kind":{"type":"string","knownValues":["physical","digital","commission","membership","service","ticket","support","other"],"maxLength":32},"description":{"type":"string","maxGraphemes":1000,"maxLength":10000},"price":{"type":"ref","ref":"#priceInput"},"inventory":{"type":"ref","ref":"#inventoryInput"},"variantOf":{"type":"ref","ref":"com.atproto.repo.strongRef"},"appProductRef":{"type":"ref","ref":"#appProductRef"},"fulfillmentUrl":{"type":"string","format":"uri"},"appLabel":{"type":"string","maxGraphemes":80,"maxLength":800},"appUrl":{"type":"string","format":"uri"},"appIconUrl":{"type":"string","format":"uri"}}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["product","price"],"properties":{"product":{"type":"ref","ref":"com.atproto.repo.strongRef"},"price":{"type":"ref","ref":"com.atproto.repo.strongRef"}}}},"errors":[{"name":"AppEnvironmentNotConfigured","description":"The app environment is not configured in ATM."},{"name":"InvalidVariantParent","description":"variantOf must reference one of the caller's own products."},{"name":"InvalidUrl","description":"A supplied URL is not an acceptable http(s) URL."},{"name":"InventoryEnvironmentMissing","description":"Inventory tracking requires a configured app environment."},{"name":"InventoryQuantityTooLow","description":"Inventory quantity cannot be lower than already-sold units."},{"name":"WriteFailed","description":"ATM could not write the product or price records."}]},"appProductRef":{"type":"object","properties":{"type":{"type":"string","knownValues":["shop","commission","membership","membership-tier","custom"],"maxLength":32},"id":{"type":"string","maxLength":512},"uri":{"type":"string","format":"at-uri"},"cid":{"type":"string","format":"cid"}}},"priceInput":{"type":"object","required":["currency","type"],"properties":{"currency":{"type":"string","minLength":3,"maxLength":3},"unitAmount":{"type":"integer","minimum":0,"description":"Amount in the smallest currency unit. Required unless billingScheme is tiered; the preset/display amount when customUnitAmount is enabled."},"type":{"type":"string","knownValues":["one-time","recurring"],"maxLength":16},"recurring":{"type":"ref","ref":"#recurringInput"},"customUnitAmount":{"type":"ref","ref":"#customUnitAmountInput"},"billingScheme":{"type":"string","knownValues":["per-unit","tiered"],"maxLength":32},"tiersMode":{"type":"string","knownValues":["graduated","volume"],"maxLength":32},"tiers":{"type":"array","maxLength":100,"items":{"type":"ref","ref":"#tierInput"}}}},"recurringInput":{"type":"object","required":["interval"],"properties":{"interval":{"type":"string","knownValues":["day","week","month","year"],"maxLength":16},"intervalCount":{"type":"integer","minimum":1,"maximum":1095,"description":"Number of interval units between billings. Defaults to 1."}}},"customUnitAmountInput":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"},"preset":{"type":"integer","minimum":0},"minimum":{"type":"integer","minimum":1},"maximum":{"type":"integer","minimum":1}}},"tierInput":{"type":"object","properties":{"upTo":{"type":"integer","minimum":1,"description":"Inclusive upper quantity bound for this tier. Omit on the final tier (no upper bound)."},"unitAmount":{"type":"integer","minimum":0},"flatAmount":{"type":"integer","minimum":0}}},"inventoryInput":{"type":"object","required":["trackInventory"],"properties":{"trackInventory":{"type":"boolean"},"quantityTotal":{"type":"integer","minimum":0,"maximum":1000000}}}}}