Skip to main content

Set up Stripe with Tolt

Connect Stripe so Tolt can track the customers and payments your partners refer.

Written by Nick

Connect Stripe so Tolt can credit partners for the customers they refer. You install the Tolt app in Stripe, add the tracking script to your site, and pass each visitor's referral to Stripe at checkout. From then on, every payment, renewal and refund from that customer is matched to the partner.

This guide covers Stripe Checkout and the Stripe API. For Payment Links, Pricing Tables or Buy Buttons, see the guides under Good to know.

Connect Stripe

  1. Go to Settings › Integrations, click Add integration and choose Stripe.

  2. Under 1. Connect Stripe, click Install the Tolt app.

    Stripe setup page with the Install the Tolt app button highlighted
  3. Approve access in Stripe. Stripe sends you back to Tolt.

The Tolt app gets read-only access to your Stripe data, except coupons and promotion codes, which Tolt creates for partner coupon codes. There's no webhook to set up.

Add the tracking script

Under 2. Add the tracking script, copy the script and paste it inside the <head> tag of every page of your website and app:

<script
async
src="https://files.tlt-cdn.com/v2/tlt.js"
data-tolt="YOUR_PUBLIC_KEY"
></script>

The script on the page already includes your public key. Use the Next.js or Google Tag Manager tab if your site uses them. On Webflow, Framer or WordPress, paste it into the site-wide head code.

Pass the referral to Stripe

The tracking script stores each referred visitor's referral in window.tolt_referral. Send it from the browser to your server, and add it as tolt_referral in the metadata when you create the Checkout Session:

const session = await stripe.checkout.sessions.create({
mode: "subscription",
line_items: [{ price: "price_123", quantity: 1 }],
success_url: "https://example.com/welcome",
cancel_url: "https://example.com/pricing",
metadata: referral ? { tolt_referral: referral } : undefined,
});

For one-time payments (mode: "payment"), also set customer_creation: "always". Tolt can't credit a partner for a checkout without a Stripe customer.

Creating customers or subscriptions with the Stripe API instead? Add the referral to the customer's metadata, so every later payment stays with the partner:

const customer = await stripe.customers.create({
email: "[email protected]",
metadata: { tolt_referral: referral },
});

Save the integration

  1. Optionally, under 4. Settings, switch on Exclude Stripe tax to calculate commissions on the amount before tax.

  2. Click Save integration.

Tolt now tracks payments, refunds and cancellations from the customers your partners refer. The integration shows under Connected in Settings › Integrations.

Good to know

Did this answer your question?