## Event Types Overview

This is a list of all the event types Flex currently sends. We may add more types at any time, so when developing and maintaining your code, you should not assume this list is exhaustive. All events follow the pattern of

```
{
    event_dt: integer,
    event_id: string,
    event_type: string,
    object: object
}
```
where `object` is the object that was created, updated, deleted, etc.

## Charge Dispute Events

**charge.dispute.closed** where `object` is the dispute object  
Occurs when a dispute is closed and the dispute status changes to won or lost.

---

**charge.dispute.created** where `object` is the dispute object  
Occurs whenever a customer disputes a charge with their bank (chargeback).

---

**charge.dispute.funds_reinstated** where `object` is the dispute object  
Occurs when funds are reinstated to your account after a dispute is closed. This includes partially refunded payments.

---

**charge.dispute.funds_withdrawn** where `object` is the dispute object  
Occurs when funds are removed from your account due to a dispute.

---

**charge.dispute.updated** where `object` is the dispute object  
Occurs when the dispute is updated (usually with evidence).

## Charge and Refund Events

**charge.refund.updated** where `object` is the refund object  
Occurs whenever a refund is updated, on selected payment methods.

---

**charge.refunded** where `object` is the charge object  
Occurs whenever a charge is refunded, on selected payment methods.

## Customer Events

**customer.created** where `object` is the customer object  
Occurs whenever a new customer is created.

---

**customer.deleted** where `object` is the customer object  
Occurs whenever a customer is deleted.

---

**customer.updated** where `object` is the customer object  
Occurs whenever any property of a customer changes.

## Subscription Events

**customer.subscription.created** where `object` is the subscription object  
Occurs whenever a customer is signed up for a new plan.

---

**customer.subscription.updated** where `object` is the subscription object  
Occurs whenever an existing subscription changes (e.g., plan changes, payment failure, cancellation, status transitions like `active` → `past_due`). **Not fired at subscription creation**, and not reliably fired on `trialing` → `active` transitions. To detect new subscriptions, listen to `customer.subscription.created` (gated on `status in (trialing, active)`) or `invoice.payment_succeeded`.

---

**customer.subscription.deleted** where `object` is the subscription object  
Occurs whenever a customer’s subscription ends.

## Invoice Events

**invoice.created** where `object` is the invoice object  
Occurs whenever a new invoice is created.

---

**invoice.finalized** where `object` is the invoice object  
Occurs whenever an invoice transitions from `draft` to `open` and is ready for payment.

---

**invoice.paid** where `object` is the invoice object  
Occurs whenever an invoice is paid in full. Fires alongside `invoice.payment_succeeded` for paid invoices.

---

**invoice.payment_failed** where `object` is the invoice object  
Occurs whenever an invoice payment attempt fails (e.g., declined card, insufficient funds). For subscriptions, this is typically followed by a `customer.subscription.updated` event transitioning the subscription to `past_due`.

---

**invoice.payment_succeeded** where `object` is the invoice object  
Occurs whenever an invoice payment attempt succeeds. For subscriptions, this is the most reliable signal that a customer has paid — recommended for provisioning or extending entitlements.

## Payment Intent Events

**payment_intent.created** where `object` is the payment intent object  
Occurs whenever a new PaymentIntent is created.

---

**payment_intent.succeeded** where `object` is the payment intent object  
Occurs whenever a PaymentIntent has succeeded.

## Refund Events

**refund.created** where `object` is the refund object  
Occurs whenever a refund is created, on selected payment methods.

---

**refund.updated** where `object` is the refund object  
Occurs whenever a refund is updated, on selected payment methods.
