Skip to main content

Set up Stripe Buy Button with Tolt

Track payments from Stripe buy buttons and credit them to the right partner.

Written by Nick

Set up Stripe Buy Button with Tolt so payments through your buy buttons are credited to the partner who referred the customer. Tolt adds each visitor's referral ID to the button, and Stripe passes it back with the payment.

  1. Go to Settings › Integrations, click Add integration, select Stripe and click Continue with Stripe.

  2. Open the Buy button tab.

    Stripe integration page with the Buy button tab selected
  3. Under Connect your Stripe account, click Install the Tolt app and follow the steps in Stripe.

  4. Copy the tracking script from Add the Tolt tracking script to your site and paste it into your website's <head> tag.

  5. Paste this script into the <body> of every page with a buy button:

    <script>
    const updateStripeBtns = () => {
    var stripeBuyButtons = document.querySelectorAll("stripe-buy-button");
    if (window.tolt_referral && stripeBuyButtons.length > 0) {
    stripeBuyButtons.forEach(stripeBuyButton => {
    stripeBuyButton.setAttribute("client-reference-id", window.tolt_referral);
    })
    }
    }

    setTimeout(updateStripeBtns, 1000);
    setTimeout(updateStripeBtns, 1900);
    setTimeout(updateStripeBtns, 2600);

    window.addEventListener("tolt_referral_ready", function() {
    if (window.tolt_referral) {
    updateStripeBtns();
    }
    });
    </script>
  6. Click Save integration.

Payments through your buy buttons are now credited to the partner who referred the customer.

Good to know

  • For developers: the Stripe integration guide in Tolt's API docs has more code examples and explains how Tolt matches payments to partners.

  • To test without being charged, create a 100% off coupon in Stripe and use it for a test purchase. See Test the integration.

  • Need a hand? Contact us via chat and we'll set up Stripe with you.

Did this answer your question?