Bearing

Help · Use Bearing

Revenue: connect Stripe

See what your site earns and which sources and campaigns it comes from, by connecting its Stripe account with a read-only key.

Bearing can read the payments of your site's Stripe account and show them next to your visits: what you were paid and, for each payment it can join to a visit, the source and the campaign of that visit. Bearing only reads: the key you give it cannot change anything in your Stripe account, and you can cancel it in Stripe at any time.

1. Create the key in Stripe

  1. Sign in to Stripe and open the API keys page. Check at the top left that you are in the right Stripe account, and not in test mode.
  2. Click Create restricted key. If Stripe asks what the key is for, say you are sending it to a third-party application: its name is Bearing, its address bearingstats.com.
  3. Give the key a name you will recognise, for example Bearing.
  4. Stripe may have ticked permissions in advance: about twenty Write permissions when the key is meant for a third-party application. Put every line back on None, then set only two lines to Read: Charges and Refunds, and Checkout Sessions.
  5. Scroll through the list once to check that nothing else is ticked, click Create key, confirm it is you if Stripe asks, then copy the key. It starts with rk_live_. Stripe shows it only once.

2. Paste it in Bearing

  1. Open your site's Settings, section Revenue (Stripe).
  2. Paste the key and click Connect.

Bearing imports your payments of the last 12 months, which takes a few minutes, then reads the new ones once a day. The Read now button reads them at once. Your Statistics page gains a Revenue card.

Bearing refuses a secret key (sk_…), which could do everything in your account. One Stripe account counts for one site.

Where you see it

  • On the visitors curve: the money that came in shows as bars under the visitors, on the same days, with its own scale. Pass over a day to read both.
  • In the Revenue card: the total of the period, then by source and by campaign.
  • On the page of all your sites, on each site's card, and live in the Live tab.

How a payment finds its source

  • Stripe payment links (addresses starting with buy.stripe.com): nothing to do. When a visitor clicks the link on your site, Bearing adds a code for this visit to it, and Stripe gives the code back with the payment.
  • Subscriptions: the first payment gets the source of the visit; the renewals keep it.
  • A payment page built by a developer: see below.
  • Everything else (an invoice paid by transfer, a sale in person, a platform that collects through your Stripe account) counts in your revenue as Source unknown. It is real revenue: Bearing never spreads it over your sources.

The source is the one of the visit where the payment started. To also see which visits end in a purchase, mark the event as a goal.

For a developer

bearing.token() returns the code of the visit in progress (32 characters). Hand it to Stripe when you create the payment:

// In the browser, when the visitor starts to pay
const token = window.bearing?.token?.();

// On your server, for a Checkout Session
await stripe.checkout.sessions.create({ client_reference_id: token /* , … */ });

// or for a PaymentIntent
await stripe.paymentIntents.create({ metadata: { bearing_token: token } /* , … */ });
  • A link to your own payment page: add the attribute data-bearing-checkout to it, and Bearing adds client_reference_id to its address.
  • A Stripe pricing table: set its client-reference-id attribute to the token.
  • A free trial without a card: keep the token with the account at sign-up, and pass it when the customer pays, even weeks later.
  • The token is made in the page's memory when you ask for it. It is not a cookie, and nothing is stored on the visitor's device.

What Bearing keeps, and what it does not

  • For each payment: its amount, currency, date, what was refunded, and Stripe's reference for the payment.
  • A one-way fingerprint of Stripe's customer reference, only to recognise that two payments come from the same customer.
  • Never the buyer's name, email, address or card.
  • Your key is stored encrypted and is never shown again.

Disconnect

In Settings, section Revenue (Stripe), click Disconnect: Bearing forgets the key and stops reading. Payments already imported stay in your statistics. To cut the access from Stripe's side, open the key's menu on the API keys page and choose Expire key.