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:
- Session Attribution: Each payment is linked to the user's current analytics session
- Anonymous ID Tracking: Pre-signup user journeys are tracked across sessions
- 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:
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
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
| Field | Required | Description |
|---|---|---|
databuddy_client_id | Yes | Your Databuddy Client ID |
databuddy_session_id | Yes | Current session ID for attribution |
databuddy_anonymous_id | No | Anonymous user ID for cross-session tracking |
Autumn passes this metadata to Stripe's payment_intent_data.metadata, which then flows through to Databuddy's webhook processing.
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:
- Go to your Databuddy dashboard
- Navigate to Revenue in the sidebar
- View revenue metrics, trends, and transaction history
- Use filters to analyze revenue by session, time period, or plan
Troubleshooting
Payments Not Appearing
If Autumn payments aren't showing in Databuddy:
- Verify metadata is passed: Ensure
getStripeMetadata()or equivalent is called and returns valid data - Check client ID: The
databuddy_client_idmust match your Databuddy website's Client ID - 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:
- Check session ID: Ensure
databuddy_session_idis being passed in metadata - Verify SDK initialization: The Databuddy SDK must be initialized before calling
getTrackingIds() - Check session timing: Sessions expire after 30 minutes of inactivity
Related Resources
How is this guide?