Bearing

Help · Use Bearing

Revenue from any payment system: sent by your site's server

PayPal, your shop's own checkout, a platform that warns your site of each sale: your site's server tells Bearing each payment, which joins the visit it came from.

If your site is paid through something other than Stripe, its server can tell Bearing each payment itself. Bearing then shows it like any other: in the Revenue card, on the chart, by source and by campaign. This page is for a developer, or for the AI that writes your site's code: give it this page.

Set it up

  1. Open AI access, then Keys, and create a key For your site's server. It only sends, and reads nothing. Keep it on your server, never in a page.
  2. In the page, when the visitor starts to pay, take the visit token and send it to your server with the order (or pass it through your payment system, if it lets you attach a value to the payment and gives it back). The token is made in the page's memory, is never stored on the visitor's device, and only lets a payment join the visit it started in.
  3. On your server, once the payment is confirmed (your payment system says so, often by calling an address of your site), post it to Bearing with the key and the token.
// In the page, with the order:
const token = window.bearing && window.bearing.token ? window.bearing.token() : "";
curl -X POST https://bearingstats.com/api/v1/payments \
  -H "Authorization: Bearer bst_…" \
  -H "Content-Type: application/json" \
  -d '{"site": "example.com", "amount": 29.99, "currency": "EUR", "id": "order-1042", "token": "…"}'
  • site: your site's domain, or its identifier.
  • amount: what was paid, in the currency's own units: 29.99 for €29.99, not 2999.
  • currency: its three-letter code, EUR, USD…
  • id: your own reference for this payment (an order number, a transaction's identifier). The same one is recorded once, so a retry never counts twice, and it is what a refund names.
  • token: optional, what bearing.token() returned. Leave it out when the page had none (the script was blocked).
  • paid_at: optional, when it was paid, as a date and time with its offset (2026-11-15T10:42:00+01:00). Without it: now.
  • customer: optional, your own reference for the customer, never an email. Bearing only keeps a fingerprint of it, to recognise two payments of the same customer.
  • recurring: optional, true for a subscription's payment, false for a one-off sale. Without it the payment shows as Not known, never as a one-off sale by default.
  • renewal: optional, true when it is not this customer's first payment. Without it, Bearing sees it from customer.
  • refunded: optional, what was refunded so far, in the same units as amount.
  • provider: optional, a short word for what took the payment (paypal, woocommerce): it shows in your site's Settings and in your export.

How it is counted

  • With a token Bearing knows, the payment joins its visit and takes that visit's source and campaign, even if it is paid days later.
  • Without a token, or with one Bearing never received because the browser sent nothing, the payment is real revenue in Source unknown. Bearing never spreads it over your sources.
  • With `customer`, a later payment of the same customer that comes with no token keeps the source of their first payment (a subscription's renewal), and counts among the customers who were already paying.
  • Nothing from before the first day Bearing measured your site: such a payment is refused, and the answer gives that day.
  • A payment does not count toward your plan.

A refund

Send the payment again with the same id and refunded, the total refunded so far. A payment already recorded keeps its amount, its date and its visit: only what was refunded changes.

What Bearing answers

Your server holds a key, so the answer says what happened:

{ "recorded": true, "visit": true }        recorded, with the source of a visit
{ "recorded": true, "visit": false }       recorded, source unknown
{ "recorded": false, "refunded": true }    known payment: what was refunded is updated
{ "recorded": false, "duplicate": true }   this id was already recorded, nothing changed
{ "recorded": false, "test": true }        a try: see below

An error comes with a sentence that says what to change: 401 for a missing or revoked key, 404 for a site that is not in your account, 400 for a message Bearing cannot read, 409 for a payment dated before your site was measured, 429 when too much arrives at once.

Try it without changing your numbers

Start a payment from a browser where you excluded your own visits. That browser's token says so, and what your server sends with it is a try: nothing is recorded, the answer says test, and your site's Settings show try received under Revenue (another payment system). You then know the whole path works, from the page to your server to Bearing.

What Bearing keeps, and what it does not

  • For each payment: its amount, currency, date, what was refunded, your reference for it and the word you gave for what took it.
  • A one-way fingerprint of your customer reference, only to recognise that two payments come from the same customer.
  • Never the buyer's name, email, address or card: do not send them, Bearing has no field for them.

Stripe does not come through here: connect it and Bearing reads it itself. One payment, one way in: what Bearing reads in Stripe must not also be sent by your server. See every payment provider Bearing follows.