Event overview

Events are our way of letting you know when something interesting happens in your account. When an interesting event occurs, we create a new Event object. For example, when a payment succeeds, we create a payment_succees event, and when an order is refunded, we create a payment_refund event.

Event types

This is a list of all the types of events we currently send. We may add more at any time, so in developing and maintaining your code, you should not assume that only these types exist.

  • payment_success - A payment has been successfully processed.
  • payment_refunded - A payment has been refunded.
  • payment_failed - A payment has failed.
  • subscription_created - A subscription has been created.
  • subscription_interval - A subscription’s next billing interval has been started.
  • subscription_updated - A subscription has been updated.
  • subscription_cancelled - A subscription has been cancelled.

Example object

type EventObject = {
  id: string; // uuid
  data: {
    items: {
      object: "item"; // string literal
      id: string; // uuid
      name: string;
      value: number; // integer value in the smallest currency unit, defaults to 0
      quantity: number;
      currency: string; // ISO 4217 currency code
      product: ProductObject;
      variant: VariantObject;
      offer: OfferObject;
      plan: VariantObject; // subscriptions product's plans are in fact variants
      internalId: string | null;
      customFields: Record<string, string>; // custom fields keys are defined by the store owner, values are filled by customer
    }[];
    order: OrderObject;
    payment: PaymentObject;
    customer: UserObject;
  };
  type: string; // one of "payment_success", "payment_refunded", "payment_failed", "subscription_created", "subscription_interval", "subscription_updated", "subscription_cancelled"
  idempotencyKey: string; // uuid
  testMode: boolean;
};