Skip to navigation

Apply Dunning End Behavior

View as Markdown

Apply dunning end behavior to a subscription.

Called by the Restate workflow when dunning period ends without payment. Applies one of six configurable behaviors:

  • cancel_and_uncollectible: Cancel subscription + Mark invoices uncollectible (default)
  • cancel_and_open: Cancel subscription + Leave invoices open (still collectible)
  • cancel_and_void: Cancel subscription + Void invoices
  • past_due_and_uncollectible: Keep subscription past_due + Mark invoices uncollectible
  • past_due_and_open: Keep subscription past_due + Leave invoices open
  • past_due_and_void: Keep subscription past_due + Void invoices

If the subscription has excessive retries and needs catch-up dunning emails, returns needs_more_catchup=True. The workflow should delay before re-evaluating to space out the catch-up emails.

Works for both User and API Key authentication. Account access is automatically validated via endpoint dependency.

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
Idempotency-Keystring or nullOptional>=8 characters
A unique key for this request. A retry with the same key returns the first response instead of running again, for 24 hours. Keys are per caller.

Request

This endpoint expects an object.
dunning_behaviorstringRequired
reasonstring or nullOptional
invoice_idstring or nullOptional

Response

Successful Response
statusstring
needs_more_catchupbooleanOptionalDefaults to false
catchup_emails_sentintegerOptionalDefaults to 0
subscription_cancelledbooleanOptionalDefaults to false

Errors

422
Unprocessable Entity Error