Stripe subscriptions and invoices
Preserve attribution across subscription signup, renewals, failures, and lifecycle changes.
Recurring revenue has two related attribution problems: matching the original subscription signup and reconnecting later invoice payments to the same customer journey.
Attribute subscription signup
When Checkout creates the subscription, set the Talivia session on both the Checkout Session and the downstream Subscription.
const metadata = {
talivia_session_id: sessionId,
};
await stripe.checkout.sessions.create({
mode: 'subscription',
line_items: [{ price: 'price_monthly', quantity: 1 }],
success_url:
'https://your-site.com/thanks?session_id={CHECKOUT_SESSION_ID}',
metadata,
subscription_data: { metadata },
});Stripe exposes Checkout metadata on Checkout events and subscription metadata on Subscription events. For invoices created by a subscription, Stripe places that metadata under the invoice's subscription details. Talivia reads both the current parent.subscription_details.metadata shape and the earlier subscription_details.metadata shape.
Connect the customer identity
Call identify when the customer logs in, signs up, or reaches the authenticated product.
window.talivia.identify('user_123', {
email: currentUser.email,
stripeCustomerId: currentUser.stripeCustomerId,
});Talivia can then attribute a renewal through the Stripe customer even though the renewal happens without a new browser checkout session.
Events Talivia maintains
The managed Stripe webhook receives:
- successful and failed invoice payments;
- subscription creation, updates, cancellation, pause, resume, trials, and pending updates;
- successful refunds and refund updates;
- dispute creation, updates, closure, and funds movements.
Initial Checkout and invoice events can arrive in either order. Talivia reconciles them into one payment using the Payment Intent, Checkout Session, customer, amount, and event time instead of counting the signup twice.