Fixing a silent webhook failure: payment_intent.failed now delivers correctly
Fixing a silent webhook failure: payment_intent.failed now delivers correctly
Release: v1.0.81
What happened
We identified a spec drift in the Calmony Pay subscription billing pipeline that caused a silent failure in webhook event delivery.
When a subscription billing charge fails — for example, due to an expired card or insufficient funds — Calmony Pay is supposed to emit a payment_intent.failed webhook event to any registered endpoint subscribed to that event type. This is documented in the Calmony Pay REST API Contract and is correctly listed in the platform's KNOWN_EVENT_TYPES registry.
However, the internal subscription billing function was emitting a different event name: payment_intent.payment_failed. Because no webhook endpoint subscription can match an unrecognised event type, the delivery was silently dropped. Customers subscribed to payment_intent.failed received nothing.
Why this matters
For SaaS products built on top of Calmony Pay, payment_intent.failed is a critical signal. It is the event that typically triggers:
- Dunning flows and retry logic
- Customer notifications about failed payments
- Subscription downgrade or suspension logic
- Internal alerting and revenue tracking
Because the event was never delivered, any downstream automation relying on payment_intent.failed was silently broken for subscription billing failures. One-off payment failures were not affected.
What was fixed
The subscription billing function (src/inngest/functions/subscription-billing.ts) now emits the correct event type — payment_intent.failed — matching the API contract and the KNOWN_EVENT_TYPES list in src/app/api/v1/webhook_endpoints/route.ts.
No changes were made to the webhook payload structure, delivery mechanism, or any other event types.
Do you need to take action?
| Scenario | Action required |
|---|---|
You subscribed to payment_intent.failed and saw no events on subscription failures | No action needed — events will now arrive correctly |
You built a workaround and subscribed to payment_intent.payment_failed | Update your webhook endpoint subscription to payment_intent.failed |
| You only process one-off payment failures | Not affected — no action needed |
A note on spec drift
This fix was surfaced through automated spec drift detection against the pinned Calmony Pay REST API Contract. The contract defines the canonical list of event types, and the KNOWN_EVENT_TYPES registry in the webhooks route handler is the enforcement point. Any emitted event name that doesn't appear in that list, or that diverges from the contract, will be flagged for correction.
If you rely on webhook events in your integration, the Webhook Events reference is the authoritative source for all supported event type names.