Skip to main content

Overview

The subscription.created webhook is triggered when a new subscription is created for a customer in your Metrifox account.

When It’s Triggered

This event is sent immediately after a subscription is successfully created, which can happen when:
  • A customer purchases a plan that creates a subscription
  • A subscription is created through the API
  • A subscription is manually assigned to a customer
  • A scheduled subscription becomes active

Payload Structure

{
  "id": "550e8400-e29b-41d4-a716-446655440004",
  "type": "subscription.created",
  "created_at": 1704067440000,
  "data": {
    "subscription": {
      "id": "101",
      "subscription_key": "sub_abc123",
      "customer_id": "123",
      "customer_key": "cust_abc123",
      "plan_id": "plan_456",
      "plan_name": "Pro Plan",
      "status": "active",
      "billing_interval": "monthly",
      "current_period_start": "2024-01-01T00:00:00Z",
      "current_period_end": "2024-02-01T00:00:00Z",
      "tenant_id": "456",
      "created_at": "2024-01-01T00:04:00Z",
      "updated_at": "2024-01-01T00:04:00Z"
      // ... other subscription fields
    },
    "subscription_items": [
      {
        "id": "201",
        "feature_id": "feature_789",
        "quantity": 1
      }
    ]
  }
}

Data Fields

The payload includes:

data.subscription

  • id: Internal subscription ID
  • subscription_key: Unique subscription identifier
  • customer_id: ID of the customer who owns the subscription
  • customer_key: Customer key
  • plan_id: ID of the plan associated with this subscription
  • plan_name: Name of the plan
  • status: Subscription status (e.g., “active”, “cancelled”, “past_due”)
  • billing_interval: Billing frequency (e.g., “monthly”, “yearly”)
  • current_period_start: Start date of current billing period
  • current_period_end: End date of current billing period
  • tenant_id: The tenant ID this subscription belongs to
  • created_at: Timestamp when the subscription was created
  • updated_at: Timestamp when the subscription was last updated
  • Additional subscription-specific fields

data.subscription_items (optional)

Array of subscription items/features included in the subscription.

Example Use Cases

  • Activate features in your application for the customer
  • Send subscription confirmation emails
  • Sync subscription data to your CRM
  • Trigger onboarding workflows for new subscribers
  • Update user access levels