Revenue

Autumn

Autumn is a modern billing platform that integrates seamlessly with Databuddy for revenue tracking and session attribution. If you're using Autumn for billing, your revenue data is automatically tracked with full session attribution.

Overview

The Autumn integration provides:

  • Automatic Revenue Tracking: All payments flow through to Databuddy automatically
  • Session Attribution: Payments are linked to user sessions for conversion tracking
  • Subscription Management: Track recurring revenue, upgrades, and cancellations
  • Zero Configuration: Works out of the box when using the Autumn SDK

How It Works

When you use Autumn's attach() function to handle subscriptions and payments, Databuddy tracking IDs are automatically included in the Stripe metadata. This means:

  1. Session Attribution: Each payment is linked to the user's current analytics session
  2. Anonymous ID Tracking: Pre-signup user journeys are tracked across sessions
  3. Revenue Dashboard: All payments appear in your Databuddy Revenue dashboard

Implementation

Using the Autumn React SDK

The Databuddy dashboard's billing implementation shows the recommended pattern:

tsx
import { getTrackingIds } from '@databuddy/sdk';
import { useCustomer } from 'autumn-js/react';

// Helper to get Databuddy metadata for Stripe
function getStripeMetadata(): Record<string, string> {
const { anonId, sessionId } = getTrackingIds();
const metadata: Record<string, string> = {
  databuddy_client_id: process.env.NEXT_PUBLIC_DATABUDDY_CLIENT_ID,
};
if (sessionId) {
  metadata.databuddy_session_id = sessionId;
}
if (anonId) {
  metadata.databuddy_anonymous_id = anonId;
}
return metadata;
}

function UpgradeButton({ planId }) {
const { attach } = useCustomer();

const handleUpgrade = async () => {
  await attach({
    productId: planId,
    successUrl: `${window.location.origin}/billing`,
    metadata: getStripeMetadata(), // Pass Databuddy tracking IDs
  });
};

return <button onClick={handleUpgrade}>Upgrade to {planId}</button>;
}

Using the Autumn Server SDK

typescript
import { Autumn } from 'autumn-js';

const autumn = new Autumn({ secretKey: process.env.AUTUMN_SECRET_KEY });

// When attaching a product, include Databuddy metadata
const result = await autumn.attach({
customerId: userId,
productId: 'pro',
metadata: {
  databuddy_client_id: clientId,
  databuddy_session_id: sessionId,
  databuddy_anonymous_id: anonymousId,
},
});

Metadata Fields

FieldRequiredDescription
databuddy_client_idYesYour Databuddy Client ID
databuddy_session_idYesCurrent session ID for attribution
databuddy_anonymous_idNoAnonymous user ID for cross-session tracking

What Gets Tracked

When using Autumn with Databuddy metadata:

  • New Subscriptions: Initial payment and plan selection
  • Upgrades/Downgrades: Plan changes and prorated amounts
  • Renewals: Recurring subscription payments
  • Cancellations: When and why users cancel (if feedback is collected)
  • Failed Payments: Payment failures for churn analysis

Viewing Revenue Data

After implementing the integration:

  1. Go to your Databuddy dashboard
  2. Navigate to Revenue in the sidebar
  3. View revenue metrics, trends, and transaction history
  4. Use filters to analyze revenue by session, time period, or plan

Troubleshooting

Payments Not Appearing

If Autumn payments aren't showing in Databuddy:

  1. Verify metadata is passed: Ensure getStripeMetadata() or equivalent is called and returns valid data
  2. Check client ID: The databuddy_client_id must match your Databuddy website's Client ID
  3. Verify webhook setup: Ensure Stripe webhooks are configured for your Databuddy revenue endpoint

Session Attribution Not Working

If payments appear but aren't linked to sessions:

  1. Check session ID: Ensure databuddy_session_id is being passed in metadata
  2. Verify SDK initialization: The Databuddy SDK must be initialized before calling getTrackingIds()
  3. Check session timing: Sessions expire after 30 minutes of inactivity

How is this guide?