Apply Dunning End Behavior
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_id
account_id
Headers
X-Restate-Secret-Key
X-System-Reason
Idempotency-Key
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_behavior
reason
invoice_id
Response
Successful Response
status
needs_more_catchup
catchup_emails_sent
subscription_cancelled
Errors
422
Unprocessable Entity Error