EarnedStats Docs

Revenue

Stripe

Checkout Sessions, payment links and subscriptions.

1. Add the webhook

In Stripe, Developers, Webhooks, add this endpoint and select checkout.session.completed, checkout.session.async_payment_succeeded, invoice.paid and charge.refunded:

Endpoint
https://earnedstats.com/api/webhooks/stripe/YOUR_SITE_ID

2. Paste the signing secret

Copy the endpoint's signing secret (it starts with whsec_) into Settings, Revenue, Stripe.

3. The visitor id

Payment links need nothing else: the script sets client_reference_id to the visitor, unless your link already sets one. For Checkout Sessions from your server, pass it as metadata:

server.js
await stripe.checkout.sessions.create({
  // ...
  metadata: { es_visitor_id: body.es_visitor_id },
});
Tip

End your success URL with ?session_id={CHECKOUT_SESSION_ID}. A visit to it links the payment to the exact visitor even without metadata.