{
"id": "com.atiproto.payment.subscription.create",
"defs": {
"main": {
"type": "procedure",
"input": {
"schema": {
"type": "object",
"required": [
"subject",
"currency",
"interval"
],
"properties": {
"amount": {
"type": "integer",
"description": "Custom amount in cents (if pay-as-you-want enabled)"
},
"cartUri": {
"type": "string",
"format": "at-uri",
"description": "AT-URI of an existing cart to add this subscription to. If omitted, a new cart is created."
},
"subject": {
"type": "string",
"format": "did",
"description": "DID of the user to subscribe to"
},
"currency": {
"type": "string",
"maxLength": 3,
"description": "ISO 4217 currency code"
},
"interval": {
"enum": [
"monthly",
"yearly"
],
"type": "string",
"maxLength": 64,
"description": "Billing interval"
},
"workflow": {
"ref": "com.atiproto.actions#inboundWorkflow",
"type": "ref",
"description": "Workflow callback envelope. Present on agent-driven callbacks; absent on initial calls."
},
"isPrivate": {
"type": "boolean",
"description": "If true, the recipient (subject) is stored only in atiproto's private database and is omitted from the PDS subscription record."
},
"redirectUrl": {
"type": "string",
"format": "uri",
"description": "URL to redirect to after checkout completes"
}
}
},
"encoding": "application/json"
},
"output": {
"schema": {
"type": "object",
"properties": {
"cart": {
"ref": "com.atiproto.cart#view",
"type": "ref",
"description": "The created cart record (status: open)"
},
"cartUri": {
"type": "string",
"format": "at-uri",
"description": "URI of the cart record in PDS"
},
"workflow": {
"ref": "com.atiproto.actions#outboundWorkflow",
"type": "ref",
"description": "Workflow envelope. When present, the agent runs the actions and calls back. When absent, this is the final native result."
},
"checkoutUrl": {
"type": "string",
"format": "uri",
"description": "Checkout URL hosted by atiproto"
},
"subscription": {
"ref": "com.atiproto.subscription#view",
"type": "ref",
"description": "The created subscription record (status: pending)"
},
"subscriptionUri": {
"type": "string",
"format": "at-uri",
"description": "URI of the subscription record in PDS"
}
}
},
"encoding": "application/json"
},
"description": "Create a subscription to a user. Returns a one-off cart with checkout URL."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1
}