Skip to main content

Event categories

Pocketsflow webhooks are organized into the following categories:

Order Events

Track purchases, refunds, and order updates

Subscription Events

Monitor recurring billing and subscription lifecycle

Customer Events

Sync customer creation and updates

Product Events

Track product catalog changes

Review Events

Receive notifications for new product reviews

Payment Events

Monitor payment processing and failures

Invoice Events

Track subscription billing and invoices

Identity Events

Monitor KYC verification status

Order Events

order.completed

Fired when a customer successfully completes a purchase. Use cases:
  • Grant access to digital products or courses
  • Send welcome emails
  • Sync to CRM or internal database
  • Trigger fulfillment workflows
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "order.completed",
  "product": {
    "id": "prod_456def",
    "variantId": "var_789ghi"  // or null if no variant
  },
  "order": {
    "id": "order_xyz123"
  },
  "currency": "usd",
  "customer": {
    "email": "customer@example.com",
    "firstName": "Jane",
    "lastName": "Doe"
  },
  "tax": {
    "amount": 4.99,
    "rate": 0.08,
    "ToCountry": "US",
    "ToZip": "94105",
    "ToState": "CA",
    "percentage": 8.0,
    "vatNumber": null
  },
  "amount": 64.99,           // Total including tax
  "amountBeforeTax": 60.00,  // Subtotal
  "metadata": {
    "customField": "value"   // Your custom data
  }
}

order.refunded

Fired when an order is fully or partially refunded. Use cases:
  • Revoke product access
  • Update analytics dashboards
  • Send refund confirmation emails
  • Alert finance team
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "order.refunded",
  "order": {
    "id": "order_xyz123"
  },
  "refund": {
    "id": "refund_abc456",
    "amount": 64.99,
    "reason": "requested_by_customer",
    "status": "succeeded"
  },
  "customer": {
    "email": "customer@example.com"
  },
  "product": {
    "id": "prod_456def"
  }
}

Subscription Events

customer.subscription.created

Fired when a customer starts a new subscription. Use cases:
  • Grant subscription access
  • Send welcome email
  • Create member account
  • Sync to membership platform
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "customer.subscription.created",
  "subscription": {
    "id": "sub_xyz789",
    "status": "active",
    "billingInterval": "month",  // or "year"
    "currentPeriodStart": "2024-12-01T00:00:00.000Z",
    "currentPeriodEnd": "2025-01-01T00:00:00.000Z",
    "cancelAtPeriodEnd": false,
    "trialStart": null,
    "trialEnd": null
  },
  "customer": {
    "email": "customer@example.com",
    "customerId": "cus_abc123"
  },
  "product": {
    "id": "prod_456def",
    "name": "Premium Membership"
  },
  "amount": 29.99,
  "currency": "usd"
}

customer.subscription.updated

Fired when subscription details change (plan upgrade, pause, etc.). Use cases:
  • Update user permissions
  • Sync plan changes
  • Send confirmation emails
Payload: Same structure as customer.subscription.created with updated fields.

customer.subscription.deleted

Fired when a subscription is canceled (immediately or at period end). Use cases:
  • Revoke subscription access
  • Send cancellation confirmation
  • Trigger win-back campaigns
  • Update member status
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "customer.subscription.deleted",
  "subscription": {
    "id": "sub_xyz789",
    "status": "canceled",
    "canceledAt": "2024-12-15T10:30:00.000Z",
    "cancelAtPeriodEnd": false
  },
  "customer": {
    "email": "customer@example.com"
  }
}

customer.subscription.paused

Fired when a subscription is paused. Payload: Similar to subscription.updated with status: "paused".

customer.subscription.resumed

Fired when a paused subscription is resumed. Payload: Similar to subscription.updated with status: "active".

customer.subscription.trial_will_end

Fired 3 days before trial period ends. Use cases:
  • Send trial ending reminder
  • Prompt for payment method
  • Highlight premium features
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "customer.subscription.trial_will_end",
  "subscription": {
    "id": "sub_xyz789",
    "trialEnd": "2024-12-18T00:00:00.000Z",
    "daysUntilTrialEnd": 3
  },
  "customer": {
    "email": "customer@example.com"
  }
}

Invoice Events

invoice.created

Fired when a new subscription invoice is generated. Payload:
{
  "webhookId": "webhook_123abc",
  "event": "invoice.created",
  "invoice": {
    "id": "inv_123abc",
    "status": "open",
    "amountDue": 29.99,
    "currency": "usd",
    "periodStart": "2024-12-01T00:00:00.000Z",
    "periodEnd": "2025-01-01T00:00:00.000Z"
  },
  "subscription": {
    "id": "sub_xyz789"
  },
  "customer": {
    "email": "customer@example.com"
  }
}

invoice.payment_succeeded

Fired when a recurring subscription payment succeeds. Use cases:
  • Extend subscription access
  • Send receipt email
  • Update billing records
  • Track MRR
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "invoice.payment_succeeded",
  "invoice": {
    "id": "inv_123abc",
    "status": "paid",
    "amountPaid": 29.99,
    "currency": "usd",
    "paidAt": "2024-12-01T10:00:00.000Z"
  },
  "subscription": {
    "id": "sub_xyz789"
  },
  "customer": {
    "email": "customer@example.com"
  }
}

invoice.payment_failed

Fired when a recurring payment fails. Use cases:
  • Send payment failure notification
  • Request payment method update
  • Pause subscription access
  • Track churn risk
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "invoice.payment_failed",
  "invoice": {
    "id": "inv_123abc",
    "status": "open",
    "amountDue": 29.99,
    "attemptCount": 1,
    "nextPaymentAttempt": "2024-12-03T10:00:00.000Z"
  },
  "subscription": {
    "id": "sub_xyz789"
  },
  "customer": {
    "email": "customer@example.com"
  },
  "error": {
    "code": "card_declined",
    "message": "Your card was declined"
  }
}

invoice.upcoming

Fired 7 days before next invoice is due. Use cases:
  • Send payment reminder
  • Preview upcoming charges
  • Allow plan changes

Payment Events

payment_intent.succeeded

Fired when an initial subscription payment succeeds. Payload:
{
  "webhookId": "webhook_123abc",
  "event": "payment_intent.succeeded",
  "paymentIntent": {
    "id": "pi_123abc",
    "amount": 29.99,
    "currency": "usd",
    "status": "succeeded"
  },
  "customer": {
    "email": "customer@example.com"
  }
}

payment_intent.payment_failed

Fired when an initial payment fails. Payload:
{
  "webhookId": "webhook_123abc",
  "event": "payment_intent.payment_failed",
  "paymentIntent": {
    "id": "pi_123abc",
    "amount": 29.99,
    "currency": "usd",
    "status": "requires_payment_method"
  },
  "error": {
    "code": "card_declined",
    "message": "Your card was declined"
  }
}

Customer Events

customer.created

Fired when a new customer is created in your account. Use cases:
  • Add to CRM
  • Send welcome series
  • Create user account
  • Track customer acquisition
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "customer.created",
  "customer": {
    "id": "cust_123abc",
    "email": "customer@example.com",
    "firstName": "Jane",
    "lastName": "Doe",
    "country": "US",
    "createdAt": "2024-12-01T10:00:00.000Z"
  },
  "product": {
    "id": "prod_456def"  // First purchased product
  }
}

Product Events

product.created

Fired when you create a new product. Use cases:
  • Sync to external catalog
  • Update inventory systems
  • Notify affiliates
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "product.created",
  "product": {
    "id": "prod_123abc",
    "name": "My Digital Course",
    "price": 99.99,
    "currency": "usd",
    "published": false,
    "createdAt": "2024-12-01T10:00:00.000Z"
  }
}

product.updated

Fired when product details are modified. Payload: Same structure as product.created.

product.deleted

Fired when a product is deleted. Payload:
{
  "webhookId": "webhook_123abc",
  "event": "product.deleted",
  "product": {
    "id": "prod_123abc",
    "deletedAt": "2024-12-01T10:00:00.000Z"
  }
}

Review Events

review.created

Fired when a customer leaves a product review. Use cases:
  • Send thank you email
  • Display on marketing pages
  • Analyze product sentiment
  • Alert team of low ratings
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "review.created",
  "review": {
    "id": "rev_123abc",
    "rating": 5,
    "review": "Great product, highly recommend!",
    "createdAt": "2024-12-01T10:00:00.000Z"
  },
  "product": {
    "id": "prod_456def",
    "name": "My Digital Course"
  },
  "customer": {
    "email": "customer@example.com",
    "firstName": "Jane"
  },
  "order": {
    "id": "order_xyz123"
  }
}

Identity Verification Events

identity.verification_session.verified

Fired when KYC verification is completed successfully. Use cases:
  • Approve seller account
  • Enable payouts
  • Send confirmation email
Payload:
{
  "webhookId": "webhook_123abc",
  "event": "identity.verification_session.verified",
  "verificationSession": {
    "id": "vs_123abc",
    "status": "verified",
    "verifiedAt": "2024-12-01T10:00:00.000Z"
  },
  "user": {
    "id": "user_456def",
    "email": "seller@example.com"
  }
}

identity.verification_session.processing

Fired when verification is being reviewed. Payload: Similar structure with status: "processing".

identity.verification_session.requires_input

Fired when additional information is needed. Payload:
{
  "webhookId": "webhook_123abc",
  "event": "identity.verification_session.requires_input",
  "verificationSession": {
    "id": "vs_123abc",
    "status": "requires_input",
    "requiredFields": ["document_back", "selfie"]
  }
}

Common Payload Fields

All webhook events include these standard fields:
FieldTypeDescription
webhookIdstringID of the webhook configuration
eventstringEvent type (e.g., “order.completed”)
timestampnumberUnix timestamp (milliseconds)
testModebooleanWhether this is a test event
livemodebooleanOpposite of testMode
Headers:
  • X-Pocketsflow-Signature: HMAC SHA256 signature for verification
  • X-Pocketsflow-Event: Event type
  • X-Pocketsflow-Timestamp: Event timestamp

Testing Event Payloads

Using the Dashboard

  1. Go to Settings → Developers → Webhooks
  2. Select your webhook
  3. Click Send Test Event
  4. Choose an event type
  5. Review the sent payload

Logging Webhooks Locally

app.post('/webhooks', (req, res) => {
  // Log the full payload for inspection
  console.log('Event:', req.body.event);
  console.log('Payload:', JSON.stringify(req.body, null, 2));

  res.status(200).send('OK');
});

Using Webhook Testing Tools


Event-Driven Architecture Examples

Grant Course Access

app.post('/webhooks', async (req, res) => {
  res.status(200).send('OK');

  const event = req.body;

  if (event.event === 'order.completed') {
    await courses.grantAccess({
      email: event.customer.email,
      courseId: event.product.id,
      transactionId: event.order.id
    });
  }
});

Manage Subscription Access

app.post('/webhooks', async (req, res) => {
  res.status(200).send('OK');

  const event = req.body;
  const email = event.customer?.email;

  switch (event.event) {
    case 'customer.subscription.created':
    case 'invoice.payment_succeeded':
      await membership.grantAccess(email);
      break;

    case 'customer.subscription.deleted':
    case 'invoice.payment_failed':
      await membership.revokeAccess(email);
      break;
  }
});

Sync to CRM

app.post('/webhooks', async (req, res) => {
  res.status(200).send('OK');

  const event = req.body;

  if (event.event === 'customer.created') {
    await crm.createContact({
      email: event.customer.email,
      firstName: event.customer.firstName,
      lastName: event.customer.lastName,
      tags: ['pocketsflow-customer'],
      customFields: {
        firstPurchase: event.product.id,
        totalSpent: event.amount
      }
    });
  }
});

Next Steps

Authentication & Security

Learn how to verify webhook signatures

Code Examples

See complete webhook implementations

Consuming Webhooks

Best practices for handling webhooks

Webhook Overview

Back to webhooks overview