Who is this customer? Joining sign-in and billing by email
2 min read
A support email arrives: "I paid but I can't get in." To answer it you open your sign-in provider in one tab and Stripe in another, search both for the address and squint at the two results. This post is about doing that join properly once, and the cases that make it harder than it looks.
Email is the only key you share
Your sign-in provider gives each person an id like user_2abc. Stripe gives them cus_9xyz.
Unless your app wrote one into the other's metadata at sign-up, and kept doing it every time,
nothing links the two except the email address each one holds.
So the join is by email. The work is in making that reliable.
Normalise before you compare
People type addresses differently in different forms. Browsers autofill a trailing space. Some
sign-in providers keep the case you typed and some don't. Before comparing, trim the address and
lowercase it. Baseboard does exactly that and nothing more: it doesn't strip dots or +tags,
because for many mail providers those are different inboxes.
The rows that don't fit
Once the obvious join works, a few kinds of record are left over.
- Guest purchases. A Stripe Checkout payment made without an account has an email on the charge but no customer. Baseboard files it under the person with that email, or gives it a row of its own when there's no match.
- Orphaned subscriptions. A subscription whose customer was deleted still shows up when you list subscriptions. It gets its own row, so revenue isn't silently dropped.
- More than one connection. Two sign-in providers (an old one you're migrating from, say) or a second Stripe account both join on the same address, so one person can have several accounts on each side. Each one is listed, tagged with the connection it came from.
What one record gives you
With the join in place, each person has one page: when they signed up and last signed in, what they pay, their invoices and one-time purchases, and buttons to refund or ban where you're allowed. The support email above becomes one search.
That page is Baseboard's Customers page. Connect a sign-in provider and a billing provider on the Free plan and it fills in straight away.