All Docs
FeaturesCalmony PayUpdated March 15, 2026

Fix: Missing payment_method.detached Webhook Event

Fix: Missing payment_method.detached Webhook Event

Version: 1.0.89

Overview

Prior to this release, detaching a payment method from a customer via the Calmony Pay REST API did not emit a webhook event. This was a spec deviation — the POST /v1/payment_methods/:id/detach endpoint was fully functional in removing the association between a payment method and a customer, but it silently omitted the payment_method.detached event that webhook subscribers depend on.

This has now been corrected. The detach endpoint emits the payment_method.detached event on every successful detachment, bringing it into parity with the attach endpoint which has always emitted payment_method.attached.

What Changed

EndpointBeforeAfter
POST /v1/payment_methods/:id/detachDetached payment method, no webhook emittedDetaches payment method and emits payment_method.detached
POST /v1/payment_methods/:id/attachAttached payment method, emitted payment_method.attachedUnchanged

Impact

If your integration listens for webhook events to track payment method lifecycle changes, you will now receive payment_method.detached notifications whenever a payment method is successfully removed from a customer. No changes to your webhook endpoint are required — the event payload follows the same structure as other payment_method.* events.

Webhook Event Reference

payment_method.detached

Emitted when a payment method is successfully detached from a customer.

Trigger: POST /v1/payment_methods/:id/detach

Example payload:

{
  "type": "payment_method.detached",
  "data": {
    "object": {
      "id": "pm_xxxxxxxxxxxxxxxx",
      "object": "payment_method"
    }
  }
}

Note: This event is the counterpart to payment_method.attached. Integrate both events to maintain an accurate local record of which payment methods are active for each customer.

Recommended Integration Pattern

Subscribe to both lifecycle events to keep your systems in sync:

switch (event.type) {
  case 'payment_method.attached':
    // Add payment method to your local store
    break;
  case 'payment_method.detached':
    // Remove payment method from your local store
    break;
}