Browse guides
Stripe Payment Links and pricing tables
No server code: hand the click id to Stripe's hosted checkout from the page.
1 min read · For companies
Payment Links and the embeddable pricing table create the Checkout Session for you, so there is no server to add metadata in. Both accept a client_reference_id, and betterrewards credits the payment when it is a click id.
Payment Links
<script>
window.addEventListener("load", async () => {
const id = await window.BetterRewards?.ready;
if (!id) return;
for (const link of document.querySelectorAll('a[href^="https://buy.stripe.com/"]')) {
const url = new URL(link.href);
url.searchParams.set("client_reference_id", id);
link.href = url.toString();
}
});
</script>Pricing table
<script async src="https://js.stripe.com/v3/pricing-table.js"></script>
<div id="pricing"></div>
<script>
// Render the table once the click id is known, so Stripe gets it as client-reference-id.
window.addEventListener("load", async () => {
const id = await window.BetterRewards?.ready;
const table = document.createElement("stripe-pricing-table");
table.setAttribute("pricing-table-id", "prctbl_123");
table.setAttribute("publishable-key", "pk_live_123");
if (id) table.setAttribute("client-reference-id", id);
document.getElementById("pricing").append(table);
});
</script>Renewals of a subscription bought this way are credited too: the first payment links the Stripe customer to the partner. If your page renders on a server, you can also set client-reference-id from the br_click cookie there.
Then check it in your instance under Integrations → Tracking & links: Open test page proves the snippet runs on your site, and a test payment followed by I've paid, check now proves the click reaches Stripe. Nobody is credited for the test.