Cello-Stripe Integration: Webhooks, Metadata, and Revenue Attribution

Automating Stripe Referral Tracking: A Cello Integration Guide

Scaling a referral program manually is impossible. The integration between Cello and Stripe solves this by bridging the gap between marketing (User Acquisition) and finance (Revenue). By treating "Word of Mouth" with the same technical rigor as paid ads, this integration ensures you only pay for real, verified revenue.

Below is the definitive guide on how this architecture works, why it is superior to cookie-based tracking, and how to implement it to automate your revenue attribution.

What is the Cello-Stripe Integration?

At its core, the Cello-Stripe integration is an event-driven architecture that automates the lifecycle of revenue attribution.

Instead of relying on fragile browser cookies that can be blocked or deleted, this integration connects directly to your financial infrastructure. It ensures that every dollar earned through a referral—whether a one-time purchase or a recurring subscription—is instantly recognized and accurately rewarded.

Why use "Deterministic Attribution"?

Most marketing tools use "probabilistic" matching (guessing who referred whom based on IP addresses). The Cello-Stripe integration uses Deterministic, Stateless Attribution.

  • Persistence: It "stamps" the referral data directly onto the customer's financial record.
  • Immutability: Even if the customer changes devices or pays months later, the attribution link remains legally locked to their Stripe ID.
  • Accuracy: Rewards are calculated based on the final paid invoice, accounting for discounts or credits automatically.

How It Works: The "Metadata" Engine

To understand the integration, you must understand the concept of Metadata Injection.

When a user clicks a referral link, Cello generates a unique code called a cello_ucc (Unique Campaign Code). In a traditional setup, this code lives in a marketing database. In this integration, we inject this code directly into the Stripe Customer Object.

The 4-Step "Push" Mechanism

This integration avoids constant checking (polling). Instead, it uses Webhooks to "push" data in real-time.

  1. The Trigger: A customer pays an invoice or renews a subscription in Stripe.
  2. The Payload: Stripe generates a secure data packet containing the event details and the user's metadata (the cello_ucc).
  3. The Transmission: Stripe cryptographically signs this packet and sends it to Cello’s secure endpoint.
  4. The Reward: Cello receives the signal, verifies the signature, and instantly calculates the commission for the referrer.

Strategic Benefits for Growth & Finance Teams

Why should RevOps leaders and Product Managers prioritize this implementation?

  • Zero Manual Reconciliation: No more exporting CSVs from Stripe to match against referral logs. If the invoice is paid in Stripe, the reward is calculated in Cello.
  • The "Churn Gap" Solution: A major risk in referrals is paying for users who immediately cancel or request refunds. This integration listens for charge.refunded events. If a refund occurs, Cello automatically triggers a "clawback," retracting the reward to protect your margins.
  • Native Coupon Support: If you use Stripe Coupons (e.g., "Give $10, Get $10"), the integration applies the discount to the new user immediately at checkout, increasing conversion rates.
  • Scalability: Once the code is live, marketing teams can change reward percentages or tier structures (e.g., "20% for the first year") inside Cello without needing engineering resources.

Implementation Guide: How to Set It Up

Prerequisite: You need access to your Stripe Dashboard and your codebase (Backend/Frontend).

Phase 1: Capture the Data (Frontend)

When a user lands on your site via a link (e.g., yoursite.com?ref=alex123), the Cello SDK captures the referral code (cello_ucc). You must capture this code and pass it to your backend when the user signs up.

Phase 2: Inject the Metadata (Backend)

This is the most critical step. You must attach the cello_ucc to the Stripe object.

If you use the Stripe API (Direct Customer Creation):

You must add the cello_ucc and your internal new_user_id to the metadata field when creating the customer.

Technical Note: By attaching metadata here, you lock in attribution forever. Even if the user doesn't pay for 6 months, the link is preserved. (See:https://docs.stripe.com/api/customers/create).

If you use Stripe Checkout (Hosted Pages):

You must ensure the metadata is nested correctly so it propagates to the subscription.

Developers: Ensure you place metadata inside subscription_data or payment_intent_data, not just at the session root. (See: https://support.stripe.com/questions/using-metadata-with-checkout-sessions).

Phase 3: Configure Webhooks

You need to tell Stripe what to listen for. In your Stripe Dashboard (Developers $\rightarrow$ Webhooks), create an endpoint pointing to Cello and subscribe to these specific events:

  • Revenue: invoice.paid, charge.succeeded
  • Corrections: charge.refunded
  • Lifecycle: customer.subscription.deleted, customer.subscription.updated

Phase 4: Security

To prevent fraud (spoofing), Stripe provides a Signing Secret (whsec_...). You must copy this key from Stripe and paste it into your Cello dashboard. This ensures Cello only accepts financial data actually verified by Stripe.

Real-World Use Cases

B2B SaaS (Recurring Revenue)

  • The Model: A consultant refers a startup to a Project Management tool ($100/mo).
  • The Logic: The startup pays their first $100 invoice. Stripe fires invoice.paid. Cello sees the metadata and credits the consultant $20 (20%).
  • The Expansion: Three months later, the startup adds more seats and the bill rises to $500. Cello detects the higher invoice amount and automatically increases the reward to $100.

To learn more about how to integrate Cello with Stripe, check out our developer documentation.

How does Cello use Stripe metadata to track referrals without cookies?

Cello utilizes a method called "Deterministic Attribution." When a user signs up, the Cello SDK captures a unique campaign code (cello_ucc) and injects it directly into the Stripe Customer Object's metadata. Because this data is stored on Stripe's servers rather than the user's browser, the referral link persists across different devices, browser clearings, and long sales cycles.

Does the Cello-Stripe integration support recurring revenue commissions for SaaS?

Yes. This is a primary feature of the integration. Because Cello listens to the invoice.paid webhook event, every time a subscription renews in Stripe, Cello receives a signal. It then calculates the commission based on the specific invoice amount. This allows for "Lifetime Commissions" or "First Year" reward structures that automatically adjust even if the customer upgrades or downgrades their plan.

How can I prevent referral fraud using Stripe Webhooks?

Security is handled via the Stripe Signing Secret. When you configure the webhook in your Stripe Dashboard, Stripe provides a key starting with whsec_. You must add this key to your Cello integration settings. Cello uses this secret to verify the cryptographic signature of every incoming payload, ensuring that only legitimate financial events from Stripe trigger a reward payout.

Where should I inject the cello_ucc metadata in Stripe Checkout sessions?

A common implementation error is placing the metadata on the session object only. For recurring subscriptions, you must nest the metadata inside the subscription_data parameter (or payment_intent_data for one-time payments) when creating the Checkout Session. This ensures the tracking code propagates correctly to the Invoice object that Cello listens for.

What happens to the referral reward if a Stripe charge is refunded?

The integration includes an automated "Anti-Fraud" layer. Cello listens for the charge.refunded event. If a transaction is reversed in Stripe, Cello detects the change and triggers a "clawback." If the reward hasn't been paid out yet, it is cancelled. If it has been paid, it is recorded as a negative balance against future earnings, protecting your profit margins.

Do I need to update my code if I want to change the referral reward percentage?

No. This is a "No-Code Operations" architecture. Once the metadata injection (cello_ucc) is set up in your code, the data pipe is established. You can change reward percentages, switch from percentage-based to flat-fee rewards, or add tiered incentives entirely within the Cello dashboard without deploying new code.