01Run it
Straight from the command's own help.
p202 ltv subscription event sub_123 --type renewal --transaction-id ch_88902What you get
Pick the shape you need. People get a table. Add
--json, --csv or --ndjson for scripts, or -q for ids only. An AI agent gets compact JSON without asking. All output formats03Build your command
Pick values and the command line writes itself, quoted and ready to paste.
p202 ltv subscription eventSet flags below; the command updates as you type.
04Flags
7 flags, plus the global flags every command takes.
| Flag | What it does |
|---|---|
| --amountstring | Renewal or refund amount (default the subscription's amount) |
| --currencystring | Currency code; must be the account currency (default it) |
| --idempotency-keystring | Your id for this renewal or refund: the same request again records nothing; a different one under it is refused |
| --occurred-atstring | When it happened, unix seconds (default now) |
| --period-endstring | Renewal only: the new paid-through time, unix seconds (default one interval on) |
| --transaction-idstring | The payment's transaction id (also makes a retry safe when there is no key) |
| --typestringrequired | What happened (required): renewal, cancel, refundrenewalcancelrefund |
05How it works
renewal adds a renewal to the ledger (the subscription's amount unless --amount), extends the paid-through period and reactivates it; refund adds negative revenue; cancel marks it canceled and moves no money. --idempotency-key (or --transaction-id) makes a retried renewal or refund safe; a repeat answers changed: false. A different amount, time or transaction id under a used key is refused, naming the key, and records nothing.
p202 ltv subscription event sub_123 --type renewal --transaction-id ch_889
06For agents
Running this from an agent
- Read the same facts as JSON:
p202 commands ltv subscription event --json. - With
AI_AGENT,CLAUDECODEor another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with ahint. - Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
- This command writes and cannot be staged:
--stagedis refused before anything is sent. Have a person run it, or give the agent a key without write scope.
{
"path": "p202 ltv subscription event",
"use": "event <external-sub-id> --type renewal|cancel|refund",
"short": "Record a subscription's renewal (extends it, adds revenue), refund (negative revenue) or cancellation",
"long": "renewal adds a renewal to the ledger (the subscription's amount unless --amount), extends the\npaid-through period and reactivates it; refund adds negative revenue; cancel marks it canceled\nand moves no money. --idempotency-key (or --transaction-id) makes a retried renewal or refund\nsafe; a repeat answers changed: false. A different amount, time or transaction id under a used\nkey is refused, naming the key, and records nothing.\n\n p202 ltv subscription event sub_123 --type renewal --transaction-id ch_889",
"runnable": true,
"flags": [
{
"name": "amount",
"type": "string",
"default": "",
"usage": "Renewal or refund amount (default the subscription's amount)",
"required": false
},
{
"name": "currency",
"type": "string",
"default": "",
"usage": "Currency code; must be the account currency (default it)",
"required": false
},
{
"name": "idempotency-key",
"type": "string",
"default": "",
"usage": "Your id for this renewal or refund: the same request again records nothing; a different one under it is refused",
"required": false
},
{
"name": "occurred-at",
"type": "string",
"default": "",
"usage": "When it happened, unix seconds (default now)",
"required": false
},
{
"name": "period-end",
"type": "string",
"default": "",
"usage": "Renewal only: the new paid-through time, unix seconds (default one interval on)",
"required": false
},
{
"name": "transaction-id",
"type": "string",
"default": "",
"usage": "The payment's transaction id (also makes a retry safe when there is no key)",
"required": false
},
{
"name": "type",
"type": "string",
"default": "",
"usage": "What happened (required): renewal, cancel, refund",
"allowed_values": [
"renewal",
"cancel",
"refund"
],
"required": true
}
]
}