Stripe Payment Links and buy buttons
View as MarkdownPayment Links, Buy Buttons and Pricing Tables on your pages are credited to their visit with no code, and what happens when a link is opened elsewhere.
On this page
Stripe Payment Links, the Stripe Buy Button and the Stripe Pricing Table need no code. The tracking script adds the visitor and session ids to them on your pages, Stripe stores them on the payment, and Reveata reads them when Stripe reports it. You only need Stripe connected, with a restricted key or Connect with Stripe.
What the script does
| On your page | What the script adds |
|---|---|
A link to https://buy.stripe.com/… |
client_reference_id=dt_<visitorId>_<sessionId>, when the visitor clicks it (middle clicks too) |
<stripe-buy-button> |
The client-reference-id attribute, with the same value |
<stripe-pricing-table> |
The client-reference-id attribute, with the same value |
Stripe copies client_reference_id onto the Checkout Session it creates. Reveata reads it from the session, recognises the dt_ format and credits the payment to that visit. A client_reference_id you set yourself is never overwritten, and one that is not in the dt_ format is simply ignored by Reveata.
Buttons and tables added to the page later, for example by a single-page app, get the attribute on the next page view of your app.
When it does not apply
Be aware of the cases where the script cannot add the ids:
- The link is opened outside your site. A Payment Link shared in an email, a social profile, a QR code or a chat goes straight to Stripe without passing through a page that runs the script. The payment is recorded, but it carries no visitor id.
- The page sends the browser to Stripe in JavaScript, for example
window.location = 'https://buy.stripe.com/…'. The script decorates clicked links, not addresses set in code. Add the reference yourself:url + '?client_reference_id=dt_' + reveata.visitorId() + '_' + reveata.sessionId(). - Cookieless mode. The cookieless script stores no ids, so it has nothing to add.
In each case the payment still counts in your revenue, as unattributed. Reveata then tries the buyer's email: if that person was identified with the same email on your site, before or after paying, the payment is linked to their visits. Unmatched payments are tried again every hour for 90 days.
To give a link you share elsewhere a source, link to a page of your site with a tag such as ?ref=newsletter, and let the button on that page take the visitor to Stripe. The visit is then credited to the tag, and the payment follows the visit.
Check it works
- Open a page with your Payment Link in a private window, from a link ending in
?ref=test. - Hover the link or inspect the button: after a click, the Stripe address ends with
client_reference_id=dt_…. - Pay in test mode (with a test key on a test website), or make a small real purchase and refund it afterwards. A free, fully discounted checkout is not a payment, so it does not show up.
- In Reveata the payment appears under Revenue with the source
test.
Each payment is stored once under its Stripe id, however many times Stripe sends or Reveata imports it. See Why payments are never counted twice.