Skip to main content

Overview

The order.created webhook is triggered when a new order is created in your Metrifox account. Orders represent purchases of plans, add-ons, or single purchases by customers.

When It’s Triggered

This event is sent immediately after an order is successfully created, which can happen when:
  • A customer purchases a plan through checkout
  • A subscription is created
  • An add-on is purchased
  • A single purchase item is bought
  • An order is created through the API

Payload Structure

{
  "id": "550e8400-e29b-41d4-a716-446655440003",
  "type": "order.created",
  "created_at": 1704067380000,
  "data": {
    "order": {
      "id": "order_001",
      "customer_id": "cust_67890",
      "subtotal_in_base_unit": "0.0",
      "total_in_base_unit": "0.0",
      "currency_code": "USD",
      "fulfilled_at": "2026-01-01T00:10:00.000Z",
      "paid_at": "2026-01-01T00:05:00.000Z",
      "expires_at": "2026-02-01T00:00:00.000Z",
      "created_at": "2026-01-01T00:00:00.000Z",
      "updated_at": "2026-01-01T00:00:00.000Z",
      "order_number": "ORD-001",
      "customer_key": "cust_ext_67890",
      "status": "draft",
      "setup_intent_result": null,
      "tenant_id": "tenant_abc",
      "is_manual": true,
      "billing_interval": "monthly",
      "billing_interval_value": "1",
      "transitioning_subscription_id": "sub_123_transition",
      "change_type": "upgrade",
      "policy": "standard"
    }
  }
}

Data Fields

The data.order object contains the complete order record, including:
  • id: Internal order ID
  • customer_id: ID of the customer who placed the order
  • subtotal_in_base_unit: Subtotal amount in base units
  • total_in_base_unit: Total amount in base units
  • currency_code: Currency code (e.g., “USD”, “NGN”)
  • fulfilled_at: Timestamp when the order was fulfilled (if any)
  • paid_at: Timestamp when the order was paid (if any)
  • expires_at: Order expiration timestamp (if any)
  • created_at: Timestamp when the order was created
  • updated_at: Timestamp when the order was last updated
  • order_number: Human-readable order number
  • customer_key: Your external customer identifier
  • status: Order status (e.g., “draft”, “fulfilled”, “cancelled”)
  • setup_intent_result: Setup intent result (if any)
  • tenant_id: The tenant ID this order belongs to
  • is_manual: Whether the order was created manually
  • billing_interval: Billing interval (e.g., “monthly”)
  • billing_interval_value: Billing interval value
  • transitioning_subscription_id: Transitioning subscription ID (if any)
  • change_type: Order change type (if any)
  • policy: Policy applied to the order (if any)

Example Use Cases

  • Send order confirmation emails
  • Sync orders to your order management system
  • Trigger fulfillment workflows
  • Update inventory systems
  • Track sales analytics