Create Renewal Invoice

View as Markdown
Create a DRAFT renewal invoice for the next billing cycle (idempotent). Called by the Restate workflow handler to initiate subscription renewal. The invoice is created in DRAFT state and must be finalized separately. Idempotency: If a DRAFT invoice already exists for this subscription's next billing period, returns the existing invoice instead of creating a duplicate. Returns status-based response for workflow orchestration: - status: "invoice_created", "skipped", or "stopped" - subscription_id, invoice_id: Present when status is "invoice_created" - reason: Explanation when status is "skipped" or "stopped"

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

subscription_idstringRequired
account_idstringRequired

Headers

X-Restate-Secret-Keystring or nullOptional
X-System-Reasonstring or nullOptional

Response

Successful Response
statusstring
subscription_idstring or nullOptional
invoice_idstring or nullOptional
reasonstring or nullOptional
finalization_delay_secondsinteger or nullOptional

Errors

422
Unprocessable Entity Error