★ Founding program: Growth free for 90 days for the first 50 SaaS teams →

Docs · Payments

Connect Stripe to UserJourney

Trials, payments, failed charges and cancellations, on the person who made them, and in Traffic as revenue per channel.

1. Connect

In the dashboard, Setup › Payments › Stripe, paste a restricted key (rk_live_…) with write access to Webhook Endpoints, or a secret key. UserJourney creates the webhook in your Stripe account, keeps its signing secret and forgets the key.

Or add it by hand: in Stripe › Developers › Webhooks, add the URL shown on the Setup page, with these events, and paste its signing secret (whsec_…):

checkout.session.completed
customer.created
customer.updated
customer.subscription.created
customer.subscription.updated
customer.subscription.deleted
invoice.payment_failed

2. Match each payment to its person

Customers are matched by email. To be exact, even when someone pays with another address, pass the same id you give identify(). With Stripe Checkout, from your server:

const session = await stripe.checkout.sessions.create({
  mode: "subscription",
  line_items: [{ price: "price_…", quantity: 1 }],
  client_reference_id: String(user.id), // the id you pass to uj.identify()
  success_url: "https://app.example.com/billing?done=1",
});

With a Payment Link, add it to the link: https://buy.stripe.com/…?client_reference_id=USER_ID. Or put uj_id in the metadata of the Stripe customer or subscription.

Check it works

Make a test purchase, or send a test event from Stripe: the person's timeline shows the trial or the payment, and Today and Traffic count them as paying.

Everything else is in the docs →

See where your users go

Free for your first 250 users. One script and one line of code.