All Docs
FeaturesCalmony PayUpdated March 14, 2026

Subscription Lifecycle Webhooks

Subscription Lifecycle Webhooks

Calmony Pay dispatches webhook events at every stage of a subscription's life. This lets your application react in real time to subscription changes without polling the API.

Supported events

EventDescription
subscription.createdFired when a new subscription is created
subscription.updatedFired when a subscription is modified
subscription.deletedFired when a subscription is cancelled
invoice.payment_failedFired when the billing cron fails to collect payment

Event reference

subscription.created

Dispatched immediately after a subscription is created.

{
  "event": "subscription.created",
  "data": {
    "id": "sub_xxxxxxxxxxxxxxxx",
    "status": "active",
    "customer_id": "cus_xxxxxxxxxxxxxxxx",
    "plan_id": "plan_xxxxxxxxxxxxxxxx",
    "created_at": "2025-01-01T00:00:00Z"
  }
}

subscription.updated

Dispatched whenever mutable fields on a subscription are changed — for example, a plan upgrade, quantity adjustment, or status transition.

{
  "event": "subscription.updated",
  "data": {
    "id": "sub_xxxxxxxxxxxxxxxx",
    "status": "active",
    "customer_id": "cus_xxxxxxxxxxxxxxxx",
    "plan_id": "plan_yyyyyyyyyyyyyyyy",
    "updated_at": "2025-01-02T00:00:00Z"
  }
}

subscription.deleted

Dispatched when a subscription is cancelled. This fires once the cancellation is processed, whether the cancellation took effect immediately or at the end of the billing period.

{
  "event": "subscription.deleted",
  "data": {
    "id": "sub_xxxxxxxxxxxxxxxx",
    "status": "cancelled",
    "customer_id": "cus_xxxxxxxxxxxxxxxx",
    "cancelled_at": "2025-01-03T00:00:00Z"
  }
}

invoice.payment_failed

Dispatched by the billing cron job when a payment attempt against a subscription invoice is declined or otherwise unsuccessful. Use this event to trigger dunning flows, notify your customer, or pause access.

{
  "event": "invoice.payment_failed",
  "data": {
    "invoice_id": "inv_xxxxxxxxxxxxxxxx",
    "subscription_id": "sub_xxxxxxxxxxxxxxxx",
    "customer_id": "cus_xxxxxxxxxxxxxxxx",
    "amount": 2900,
    "currency": "GBP",
    "failure_reason": "insufficient_funds",
    "attempted_at": "2025-01-04T00:00:00Z"
  }
}

Handling events

Your webhook endpoint should return a 2xx HTTP status to acknowledge receipt. Any non-2xx response is treated as a failure and the event will be retried.

HTTP/1.1 200 OK

Process events idempotently — the same event may be delivered more than once in the case of retries.

Recommended flows

EventSuggested action
subscription.createdProvision access, send a welcome email
subscription.updatedAdjust feature entitlements, notify the customer
subscription.deletedRevoke access, send a cancellation confirmation
invoice.payment_failedStart a dunning sequence, email the customer to update payment details

Configuring webhook endpoints

Webhook endpoints and the event types they receive are configured in the Calmony Pay dashboard or via the Webhooks API. Your endpoint will only receive the new subscription event types if it is explicitly subscribed to them.